ID:144504
 
Code:
mob
proc
Tag
if(usr.it == 1)
world() << "[usr] tagged [src] and [src] is now it!"
else
usr << "Somebody else is it!"

mob
Enter()
Tag()


Problem description:
When i try to make proc Tag, an error comes up saying invalid proc definiton (and another saying Tag at the bottom is undefined). What am I doing wrong?
No put usr in proc. Ungh.

Lummox JR
In response to Lummox JR
How can I change it then?
In response to Mappum
You would add an argument.

Although, really, the whole way you're setting it up is completely wrong. Generally, mobs don't go entering one another. Try this:

mob
Bump(mob/obstacle) //Called when you run into a dense object
if(ismob(obstacle)) //It might be a dense turf or obj.
if(it) //If src's 'it' variable is true
world << "[src] tagged [obstacle], [obstacle] is now it!"
it=0 //src is no longer it
obstacle.it=1 //Obstacle is it
In response to Jp
Thanks for your help. From adding your code (and replacing my old code) I added 2 errors , then got rid of 3. The last one is about the obstacle.it=1. How do I define this (whatever it is, a type .it or whatever)?
Mappum wrote:
Code:
mob
> proc
> Tag
> if(usr.it == 1)
> world() << "[usr] tagged [src] and [src] is now it!"
> else
> usr << "Somebody else is it!"
>
> mob
> Enter()
> Tag()
>

I know you've got it good now, but some other things to note, just so you don't do this with something that isn't predefined like Bump...

1.The invalid prod definition was because there's no () after Tag

2.The undefined error is because world << blahblah should be tabbed 1 more time so its under the if()
In response to VcentG
VcentG wrote:
Mappum wrote:
Code:
mob
> > proc
> > Tag
> > if(usr.it == 1)
> > world() << "[usr] tagged [src] and [src] is now it!"
> > else
> > usr << "Somebody else is it!"
> >
> > mob
> > Enter()
> > Tag()
> >

I know you've got it good now, but some other things to note, just so you don't do this with something that isn't predefined like Bump...

1.The invalid prod definition was because there's no () after Tag

2.The undefined error is because world << blahblah should be tabbed 1 more time so its under the if()
I had already noticed those and fixed them, it didn't make a difference.
In response to Mappum
woot4u
In response to Mappum
Now I have another question. How do I make a random person be it when the game starts, or give it off to another person randomly when they log out.
In response to Mappum
How is your 'it' variable defined? If you change the type 'obstacle' is cast to in the proc definition (The bit that reads 'Bump(/mob/obstacle)' to the typepath of the thing you've defined it under.

As for your second question, keep a list of all the players and use the pick() procedure.
In response to Jp
Nevermind I worked it all out. Is pick() predefined or is that just a suggestion? I need someone to host this though. mappum.coolgame. Search for SmileyTag.
In response to Mappum
pick() is predefined. It takes either a list(), or a set of arguments, and returns one of the list members, or one of the arguments, at random.

mob/verb/TestPick()
src << pick("Test1","Test2","Test3")
//Equivalent to src << pick(list("Test1","Test2","Test3"))
In response to VcentG
VcentG wrote:
2.The undefined error is because world << blahblah should be tabbed 1 more time so its under the if()

No, it's more likely because he did world() << "". It's perfectly fine to not have it indented, although he probably did mean to.