ID:1434200
 
(See the best response by NNAAAAHH.)
How many ways can you give a mob variable a path?

When I was beginning all I did was this:

var/mob/m


I did what to it? I defined it? I initiated it? But this is null. It has no path. It is wrong by itself.

So these are the ways I can think of to make this not null(what is the word I'm looking for? find a path?):

m=locate()// only locates one mob

mob/verb/test(mob/M)
m=M

m=input in view() //will this work?

for(m in list)


Any other ways to find a path for this null mob?

So if this were a 2 player board game, how would I keep track of 2 players? In my checkers game I had people join if the list is not full and have world variables be assigned to the first 2 players:

var
mob
firstplayer
f
secondplayer
s

mob/verb/join()
if(playersready.len<2)
playersready+=src
world << "[src] joined the game"
if(playersready.len==2)
world << "Game is ready"

mob/verb/start_game()
if(playersready.len==2)
f=playersready[1]
s=playersready[2]


Will this work? How else can I do this in a 2 or more board game?
Best response
The player list would be fine except for one thing. By adding it the way you have, it would mess up your lists order if the mob has been deleted(IE. Logged out).

Therefore, a solution to that would be have an indexed list.

var/list/players=new

mob/verb/Join()
if(!(key in players))
players[key]=src


That would sustain even if they logged out. However, you would have to apply checks before turns and what not.

var/playerNum=3
if(players.len>=playerNum)//Just to be safe
var/mob/M=players[players[playerNum]]//Because the use of index, players[3] would simply return the index name, so you have to do list[list[index number]] if numbers are used.
if(ismob(M))
world<<"It is [M]'s turn."


Honestly, I'm not sure if this would be idea. It's just a method I did not already see posted. I would recommend using a flexible list though, to me it just seems better.