var
playercount = 0
world
mob = /mob/player
mob/player
Login()
playercount++
playernum = playercount
..()
var
playernum = 0
// - - - - - - - - - - - - - - - - - - - -
client
Click( atom/g )
var
pnum = usr.playernum
Problem description:
To begin with, I should mention that the commented dashed line was inserted to separate the two main phases that coincide to produce this error. Let's navigate from top to bottom. I created a variable called playercount that is used within the mob/player block to assign a number to each player successively at login time. So, in essence, the order of arrival is determined. Fair enough, now let's jump to the block of code beneath the dashed line. When I attempt to call the user's playernum value using usr.playernum, the compiler states that this variable is undefined. It is quite clear that I did, in fact, initialize and use this variable in the mob/player segment. Is it possible that this variable does not belong to the user, although the user is the only being who can call the Click() proc beneath client? I have tried just about every solution I could think up to solve this seemingly simple problem, but to no avail. Any potential solution to this would be greatly appreciated.
The istype() is used to ensure that usr is the type that we said it is, to avoid a runtime error.
What you wrote originally was equivalent to, "You will be given an animal. Tell me the color of its bill." The compiler says, "not all animals have bills!" and throws an error. So, instead, you have to say, "You will be given an animal. It will be a duck. If it is a duck, tell me the color of its bill."