ID:1816040
 
(See the best response by LordAndrew.)
Code:
Summoning()
var/list/Summoning = list()
var/mob/M = 1
while(M)
M = input("Who [Summoning.len ? "else " : ""]would you like to summon?","Summon #[Summoning.len]") as null|mob in (Players-Summoning-usr)
if(M)
Summoning+=M
for(var/mob/M in Summoning)
M.loc=src.loc


Problem description: Using Ter13's example code, running into duplicate definitions on: for(var/mob/M in Summoning) andvar/mob/M = 1

I already created a players list on login and logout. Just cant figure out this simple error...


The error is what it says it is. You've already defined M in the code, and later you attempt to define M again within the for loop.
Well I used Ter13's example from the previous thread, what should I do to fix this specifically?

Thanks for explaining :)

I think I need to delete the var/mob/M = 1 or the for(var/mob/M in Summoning) part?
In response to Seijinz
Best response
Just remove the var/mob/ part from the for loop, that way you're using just M instead of trying to define it again:

for (M in Summoning)
// ...
Thanks man, I understand now :)

I will take this for a test drive now :)

Much appreciations !