ID:1027198
 
Keywords: location, slot, slots
(See the best response by NNAAAAHH.)
Code:
var/list/Plains = list("One", "Two", "Three", "Four")
mob/var/PlainLoc
mob/proc/Plain_Map()

if (!Plains ["One"])
PlainLoc = "One"
src.loc=locate(2,3,3)
src.client.view="15x8"
src.client.eye=usr
else if(!Plains ["Two"])
PlainLoc = "Two"
src.loc=locate(2,3,4)
usr.client.view="15x8"
usr.client.eye=usr
else if(!Plains ["Three"])
PlainLoc = "Three"
src.loc=locate(5,37,1)
usr.client.view="15x8"
else if(!Plains ["Four"])
PlainLoc = "Four"
src.loc=locate(5,52,1)
usr.client.view="15x8"
else
usr << "You can't currently Enter"
return
Plains [PlainLoc] = 1


Problem description:
I'm trying to have it so that when two players are in a certain location no one else can enter that location, and when the two players are done the slot opens up so two others can enter. But it's not working correctly. What can I do to fix this


http://www.byond.com/docs/ref/info.html#/list
var/list/lst = list("player" = "James Byond", "score" = 2000)
//When the index values happen to be text strings that satisfy all the requirements for variable names, this may also be written in a convenient short-hand:

var/list/lst = list(player = "James Byond", score = 2000)


That should help you resolve your issue, some parts of the reference are iffy.

Example for you should be
var/list/Plains=list(One=null,Two=null,Three=null,Four=null)


I hope I stated that correctly, if not: feel free to correct me.
Does the exact same thing as before.
In response to Isenggard
I'm sorry, but what exactly isn't working correctly? I should've asked that first.

[EDIT] Also, your code would result in an indentation error. Might wanna clear that up.[END EDIT]
When I fill up all the locations it does somewhat what it's supposed to do. It keeps me where I'm at except it zooms.
And when I leave the location it and try to go back in it doesnt register that no one is in the One and either sends me to TWO or does nothing but run the else

and that was just when I pasted it here, I don't have that indention like that on the code
In response to Isenggard
Could I see the code to which you exit?
   mob/proc/Leave_Map()
if(PlainLoc=="One")
PlainLoc=null
Plains [PlainLoc] = 0
if(PlainLoc=="Two")
PlainLoc=null
Plains [PlainLoc] = 0
if(PlainLoc=="Three")
PlainLoc=null
Plains [PlainLoc] = 0
if(PlainLoc=="Four")
PlainLoc=null
Plains [PlainLoc] = 0
In response to Isenggard
Best response
You're resetting their PlainLoc variable then attempting to read it, change the position of PlainLoc=null and Plains[PlainLoc]=0.

Plains[PlainLoc]=0
PlainLoc=null
It works with the simple problem. When I enter One and leave it knows nobody is there. But if I leave without using the leave proc and go to Two and leave with the leave proc, it doesn't know that nobody is in One and sends me back to Two.
In response to Isenggard
Then when you go to two, set the one to 0 like you've done in the leave proc.

Plains[PlainLoc]=0
PlainLoc="Two"
Plains[PlainLoc]=1
That worked, thank god for your help =P
In response to Isenggard
Lol, it's fine. I'm sure you would've gotten it without me.