ID:170474
 
        Gate
icon_state="gate"
density = 1
Click()
if(src in oview(2))
var/password_1 = input("Please input a password") as password
if(!password_1) return

if(findtext("PISH")) in passwords //line with the problem
usr.loc = locate(/area/teleports/ZZ)

if(password_1=="PISH")
usr.loc = locate(/area/teleports/ZZ2)
usr.passwords+= "PISH"


What i want this to do is find the text PISH in the lists passwords. I always get stuck on lists,Where did i go wrong here?

~>Jiskuha
findtext isn't for lists, you should be using Find().
In response to SSJ2GohanDBGT
SSJ2GohanDBGT wrote:
findtext isn't for lists, you should be using Find().

how would i impliment this?
if(list.Find(Elem,Start=1,End=0))


Like that?

~>Jiskuha
In response to Jiskuha
Jiskuha wrote:
SSJ2GohanDBGT wrote:
findtext isn't for lists, you should be using Find().

how would i impliment this?
> if(list.Find(Elem,Start=1,End=0))

Like that?

~>Jiskuha

Nope,
if(passwords.Find("PISH"))


I think also using if(("PISH" in passwords)) would work, but I'm not too sure.
In response to Jiskuha
Well, here is an example how to use Find()

var/list/beta = list("Jiskuha","N1ghtW1ng")

mob/Login()
if(beta.Find(src.key))
..()
else
src << "Sorry you aren't a beta tester"

That should work -_-
In response to N1ghtW1ng
mob/var/passwords = list("")
turf/
turfs

Gate
icon_state="gate"
density = 1
Click()
if(src in oview(2))
var/password_1 = input("Please input a password") as password
if(!password_1) return
if(passwords.Find("PISH"))
usr.loc = locate(/area/teleports/PISH)
if(!usr.passwords)
if(password_1=="PISH")
usr.loc = locate(/area/teleports/PISH)
usr.passwords+= "PISH"


<font color=red>System\Map.dm:94:error:passwords.Find:undefined var</font>

Why cant it find the players list called passwords?

~>Jiskuha
In response to Jiskuha
It's not really a list.
Try
mob/var/list/passwords=list()
:)
In response to Hell Ramen
I still keep getting the error on the same line..

                    if(passwords.Find("PISH"))


Humph. I am not good at all with lists thus i need assistance :(.

~>Jiskuha
In response to Jiskuha
In the Click() proc, instead replace the following:
if(passwords.Find("PISH))

with

if(usr.passwords.Find("PISH"))
In response to SSJ Radditz
Whoops! My mistake. Thanks for fixing it, Radd.
In response to SSJ2GohanDBGT
Not a problem. =)
In response to SSJ Radditz
One last thing, how would i check if the list was empty or not?

~>Jiskuha
In response to Jiskuha
if(!list.len)
Easy, eh?
In response to Hell Ramen
And the alternate way:

if (!length(thelist))


Both work. Which one you use is just a matter of style.
In response to Crispy
You guys are my hero's. Thanks!

~>Jiskuha
In response to Jiskuha
Click()
..()
if(src in oview(2))


For click statements. ..() always needs to be called at leaste once.
In response to Hell Ramen
Hell Ramen wrote:
It's not really a list.

I'd just like to note that it was a list, it's just that Dream Maker didn't know it was. =)
In response to Tiberath
Tiberath wrote:
For click statements. ..() always needs to be called at leaste once.

It probably wouldn't hurt, but it doesn't always have to be called. It just depends on how you want it to work, if you specifically don't want any parent proc called, then you can leave it out. And what do you mean by at least once? There's no reason to call the parent proc more than once. =)
In response to YMIHere
YMIHere wrote:
Tiberath wrote:
For click statements. ..() always needs to be called at leaste once.

It probably wouldn't hurt, but it doesn't always have to be called. It just depends on how you want it to work, if you specifically don't want any parent proc called, then you can leave it out. And what do you mean by at least once? There's no reason to call the parent proc more than once. =)

I was always told to like, call the parent for Click() and topic links and stuff XD
In response to SSJ2GohanDBGT
SSJ2GohanDBGT wrote:
I think also using if(("PISH" in passwords)) would work, but I'm not too sure.

It would, but in that case, you don't need the extra set of parenthesis (not that it will do any harm, of course):

if("PISH" in passwords)


Of course, if you want to find out if PISH isn't in passwords, then you need the parenthesis because of order of operations:

if(!("PISH" in passwords))