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
kevlar
Beginner


Joined: 27 May 2005
Posts: 18

PostPosted: Tue Sep 05, 2006 2:20 pm   

using #if or %if in triggers (newbie question)
 
hi, sorry for the newbie question i've just never done this before and can't seem to get it working...

i'm on a mud where i need to keep attacking the same mob manually untill it dies. so i have to type kill ork with hammer over and over. things happen kinda fast so i want to be able to have a trigger that will do some of the work for me.

basicly i want something like this:

you see an ork here.

trigger says "kill ork with hammer"

the ork is hurt

again "kill ork with hammer"

the ork dies

trigger says "lower hammer"

i've been doing this with multiple triggers, which works... but i'm ending up with zillions of triggers. that and i would really like to learn how to use ifs. also i want to be able to have more than two outcomes... can i have 7 ifs in the same trigger? hrrm... wording that poorly... basicly if i had say 4 'stages' to a quest. enter first room, clear it out, enter second room search for treasure, enter third room kill mobs that pop. that kinda thing. i remember when i was a kid doing the whole if (whatever) go to line 10. ok, i'll shut up and see what help you guys give... then go from there.


thanks in advance!
kevlar
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Tue Sep 05, 2006 6:02 pm   
 
The best way is actually usually to create many triggers :-). However if you still want to handle it with if-statements you can try:
#trigger {^(*)$} {
#if (%trigger =~ "you see an ork here") {kill ork with hammer}
#if (%trigger =~ "the ork is hurt") {kill ork with hammer}
#if (%trigger =~ "the ork dies") {lower hammer}
} "" {notrig}
Reply with quote
kevlar
Beginner


Joined: 27 May 2005
Posts: 18

PostPosted: Thu Sep 07, 2006 4:12 am   
 
nice!

heh, as things sometimes are... that answers the question i asked PERFECTLY. but as it turns out i didn't do the best job asking the question. first though i would like to know how it is a person would have known to write things in that way. mostly the {^(*)$} { part of the first line. the trigger works perfectly like i said before, but obviously i would like to expand things... and do it correctly if possible. i've looked through the zmud help files on #trigger and never seen anything about the {^(*)$} { stuff.

second i'm thinking of putting it in an alias instead of a trigger (though i could be using them wrong.) mostly because there are a bunch of quests i would like to do that are very similar. then i can just set them up as quest1 quest2 quest3 and so on. the next big thing i will need help with is this: is there a way to break an alias or trigger into chunks? for example when the said ork pops i want to stay in the room untill he dies, then after he dies go to the next and preform a different list of things. i guess it's mostly dependant on if he pops. so how do i tell zmud to go to the next room if either a) the ork dies, or b) the ork doesn't pop and therefore doesn't need to die. another way of wording it would be go to room1 and then to room2, unless the ork pops then wait for the ork to die and then go to room2.

sorry if this seems really cluttered. i've never really done any programming so it's good you guys are patient. heh
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