Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
i7nvd
Newbie


Joined: 07 Jan 2007
Posts: 4

PostPosted: Mon May 21, 2007 11:56 pm   

Code request
 
I'm REALLY sorry if this is the wrong place to be posting this. If it is, please tell me where I SHOULD post this.
I'm having some issues trying to write a trigger code. I'm not really good yet, so I'm looking for some help from you guys.
I'm trying to write a trigger to let me dig a subsequent room when I build. What I tried to do was
Code:
 #TRIGGER {[Room &%d{vnum}]} {east dig {@vnum+1}; east}


It, as most of you can see, doesn't work. I'm trying to get it to read the header on each page:

[Room 17017] and then automatically dig vnum 17018 to the room to the east, and then move to it.

If someone can help me fix this code, I'd be deeply appreciative.

Alternatively, if someone's got MORE time and wants to help me write advanced, I'd love to do something like this...

I'd like to be able to take the vnum I'm in right now, and type something like ndig next to have it dig to the north the vnum that's one above the room I'm in. Possible?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue May 22, 2007 12:32 am   
 
It is really the wrong place to post this - this section's for posting scripts that you've written that you want to publish. The place to ask questions is the general discussion forum. I'm sure one of the intrepid moderators won't mind moving it, though :)

The problem is that [ and ] are special characters in trigger syntax. You need to tell zMUD that you don't want to use those special properties and that they actually appear in the pattern. You do this by putting a ~ before them, so your pattern becomes this:

#TRIGGER {~[Room &%d{vnum}~]} {east dig {@vnum+1}; east}

Secondly, if you're not actually using @vnum for something else, you can just do this:

#TRIGGER {~[Room (%d)~]} {east dig {%1+1}; east}

Be careful running this trigger, though. If that [Room 28572] line appears automatically when you move in a direction, this trigger will keep on creating rooms over and over unless you disable triggers.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
i7nvd
Newbie


Joined: 07 Jan 2007
Posts: 4

PostPosted: Tue May 22, 2007 12:37 am   
 
Thanks for the quick reply and the help. Since the post hasn't been moved yet, I figure it's best to reply here. The trigger is certainly triggering, but the input line after the trigger fires is actually "east dig {17042+1}" instead of "east dig 17043". Any suggestions on how to fix that?
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue May 22, 2007 12:46 am   
 
#TRIGGER {~[Room (%d)~]} {east dig {%eval(%1+1)}; east}

The %eval sorts out the problem of it being a string rather than a number
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
i7nvd
Newbie


Joined: 07 Jan 2007
Posts: 4

PostPosted: Tue May 22, 2007 2:14 am   
 
Thanks! You guys have been really helpful. I'll post in the right spot next time :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net