Author Topic: Movement Function  (Read 2250 times)

Offline agrippa

  • Acquaintance
  • *
  • Posts: 27
    • View Profile
Movement Function
« on: November 25, 2008, 07:11:21 pm »
Hi guys,

I've added the following into a room.  Basically, I want to stop anyone over a certain level moving north into the newbie area, but for some reason it doesn't appear to be working.  I've checked with the caves example from the old Praxis domain and it seems ok.  I should also point out that it doesn't error - it simply lets any players over level 2 through.  Any help would be gratefully appreciated!

The exit
Code: [Select]
AddExit("north", "/domains/kakhabad/virtual/forest/4,1", (: "go_north" :));
The go_north
Code: [Select]
int go_north() {
    if(this_player()->GetLevel() > 2) {
        message("my_action", "You have learned all you can from the proving grounds.", this_player());
        return 0;
    }
    return 1;
}

Offline Raudhrskal

  • BFF
  • ***
  • Posts: 214
  • The MUD community needs YOUR help!
    • View Profile
Re: Movement Function
« Reply #1 on: November 26, 2008, 02:45:48 am »
Guess: you shouldn't have "quotes" around func name in the ( :  : ) .

Note that after that change you must put the go_north() function BEFORE the create() in the file, because go_north must be defined before you refer to it in create.

If it still won't work, put a debug("some text") at the beginning of go_north() to verify that function is called at all. (You may need to use the "debug" command to enable printing of debug messages)
« Last Edit: November 26, 2008, 02:47:45 am by Raudhrskal »
I think, therefore i may be wrong.
Please note that if you met a Raudhrskal in a place that's not related to muds, it wasn't me. *sigh*... back when I started there was zero hits on google for that name...

Offline agrippa

  • Acquaintance
  • *
  • Posts: 27
    • View Profile
Re: Movement Function
« Reply #2 on: November 26, 2008, 06:38:23 am »
Excellent!  All working now!  Thank you very much - no more high level players slaughtering all the newbies' beasties :)