ID:1371382
 
(See the best response by Pirion.)
Code:
mob
var/list/beta_pl = list("Tafe")
beta_tester


proc
Add(mob/m)
if(!beta_pl.Find(m))
beta_pl.Add(m)
else
beta_pl.Remove(m)
beta_pl.Add(m)
Remove(mob/m)

if(beta_pl.Find(m))
beta_pl.Remove(m)


Find(mob/m)
if(beta_pl.Find(m))
return 1

mob/Login()

..()
var/mob/beta_tester/b = /mob/beta_tester
if(src.key == "Tafe")
b.Add(src)
if(b.Find(src))
src << "Success"


Problem description:

no compiler error, but... I do not get the Login() exceptions to work. Everything under mob/Login() should work, except statement:
if(b.Find(src))
mob/Login()
var/mob/beta_tester/b = new/mob/beta_tester/


Found out that this works, but is there a more stable way to do this, without actually having to create a new/mob/beta_tester/ ?
Best response
Unfortunally we don't have much information here except your attempt to impliment something. Try to be more descriptive on what the issue and goals are of the code you are posting, espeically if it is not plainly obivous.

Looking at the code, I think that the goal is to implement a method of checking if players are allowed to enter.

To do this, all you need to do is check in client/New() if they can connect, no need to even create the a mob.

var/list/testers = list("tafe","pirion") //you and I only, everyone else kicked out

client/New()
if(can_connect())
world << "[src.ckey] has connected."
..() //this will give base client/New() control to create the initial mob and start the login.
else
world << "[src.ckey] attempted to sign in but was blocked."
return //return without calling ..() which calls the base behavior of client/New()
//this will not log the player in, and will display a connection disconned message.

client/proc/can_connect()
. = 0 //we return false unless they can. This is not needed, except to be able to visualize.
if(src.ckey in testers)
. = 1 //set to true value if they can
return . //also not needed, but to visualize
What i am attempting to do, is to implement a method that i can use to give players Beta-testing privileges.

Those privileges are given upon creation, in this case mob/Login()(should switch it to client/New() though)

I got it to work though. i assumed it was wrong variable defining, which it was. So, now my question is if there is a less stressing process behind this, while still use this method? I know i "should" use
var/list/beta_pl = list()
if(beta_pl.Find(src))
src << "Success"

instead of what i do here(Which is to create a whole method to do the excact same thing + +)
To add that to what I have above (which is the less stressful method from what you are doing)

mob/verb/add_tester(t as text)
if(ckey(t) in testers)
return //they are already in
testers += ckey(t)

mob/verb/remove_tester(t as text)
testers += ckey(t)


Though you would need to save these to retain them on world reboots.

world/New() //on create, load the file if it exists.
..()
if(fexists("testers.conf"))
var/savefile/f = new ("testers.conf")
f >> testers

world/Del() //on delete, save the file
var/savefile/f = new ("testers.conf")
f << testers
..()
Oh, this helps alot. My second problem was also, how to store the list in an efficient way. Again, this made me learn