RemoveFromOrg()
var/list/X=new()
var/listnum=0
var/dudesname=""
switch(input("Who") as null|anything in list(
"Members X","Members Y","Leader One","Leader Two"))
if("Members X")//Is a list with the members
X=MembersX //Defines the game list where the members are
listnum=1 // Defines wich list we're goint to be using below
if("Members Y")//Is a list with the members
X=MembersY //Defines the game list where the members are
listnum=2 // Defines wich list we're goint to be using below
if("Leader One")//Is just a dude
dudesname=LeaderONE //Gets the name from the game list
LeaderONE="" //Removes the name from the game list
if("Leader Two")//Is just a dude
dudesname=LeaderTWO //Gets the name from the game list
LeaderTWO="" //Removes the name from the game list
else
return
if(X)//If the option selected is a list, not a dude.
var/Z=input("What dude in the list?","Remove Org")as null|anything in X
if(Z)//If you select a dude
switch(listnum)//Wich list we're usign?
if(1)
MembersX.Remove(Z)//Remove the name from the organization list
if(2)
MembersY.Remove(Z)//Remove the name from the organization list
dudesname=Z //Gets the name from the game list
else
return
if(dudesname)
//REST OF THE CODE
The rest of the code only runs if I select an option that is a list at the beginning. I'm guessing that if(X) is returning true even if I only defined X at the beginning. I know a workaround, but want to confirm this... Any help is appreciated. Sorry in advance for bad coding and grammar.
If you want to check for an empty list, you should check X.len.
also this should be in dev help not byond help.