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


Joined: 06 Dec 2001
Posts: 22

PostPosted: Fri Dec 14, 2001 9:25 am   

i need a trigger to kill enemys, with catch
 
i need a trigger to kill enemys
(here is 3 example enemys..exactly as the would be if they were all in the same room)
------------------------
Three rabbits quietly munch on the nearby grass.
A shaggy mountain goat roams the area.
A deer stands here quietly, sniffing at the air.
----------------------------
so im guessing the basic formula for an enemy is
(number)(name)(description)

however these are not enemys
--------------
A rabbit is resting here.
A weary elf is resting here against the fountain.
Spot, a mangy street mutt, is sleeping here.
--------------
so before attacking it needs to check for these 3 things
-----------
is sleeping here
is resting here
is standing here
----------
i dont want to attack a monster if it has any of the above phrases on the same line....

i also need a triger to follow if enemy flees

when a mob flees it sends 2 lines
-------
A deer blindly flees north!
A deer flees north!
-------
in the first line the 3rd word varys (but i could only find a deer to flee)
...my trigger sends it 2 north...

3rd id like to know the command to constantly fire off a trigger after a couple seconds
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Fri Dec 14, 2001 9:26 am   
 
oh yea.. command to attack is
"kill"
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Fri Dec 14, 2001 3:01 pm   
 
First off, read the help files more. It's extremely valuable stuff. That said...

For anything I could quickly think of to work, you'll need to know the mob names of anything you'd like to potentially attack (i.e. rabbit, deer, goat). You'll need to create a list of these mob names in a variable.

Then you'll need a trigger that searches for that list of mob names followed by any amount of text, followed by a period and end of line (.$).

In that trigger you'll want to save the mob name and the following text for use in the action, and in the action part of the trigger you'll need to check for the position (see "%pos") of the words 'sleeping', 'resting' and 'standing'. If their position is <= 0, you can attack.

For the flee trigger, I'd put it in a separate class that gets turned on when you start fighting, and turns itself off on the first match of the "flees" text, so that it only executes once and doesn't send you further than you want.

The last question is a perfect use of the #alarm command. Check it out in the help files.

PS - yes, I realize I just dangled mere keywords, advice to read the help files and general directions without giving the actual commands. Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime. Read the help file


zMUD 6 Online Help: All the power you'll ever need.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Dec 15, 2001 3:58 am   
 
While I must agreee with Darker about teaching is better then giving I will you a little more of a start.

#VAR ZoneMobs {} //set this to the mobs you will likely want to kill in the area.
//mapping with a zone script would be recommended here!
#VAR NumberWords {A|Two|Three|Four|Five|Six} //repeat that out up to nine or as many as you have ever seen.
#TRIGGER {(%w) ~{@ZoneMobs~} (*).$} {
#IF ((%pos("sleeping here","%2")) | (%pos("resting here","%2") | (%pos("standing here","%2")) {#NOOP} {
#LOOP (%ismember("%1",@NumberWords) {
#ADDITEM RoomMobs {%word(%trigger,2)}
}
#DELCLASS "Attacks|Waiting" //note this command is dangerous!
#CLASS {Attacks|Waiting}
#ALARM {+2} {IssueAttack}
#CLASS 0
}
}

Your job is to debug the above since I am half in the bag, and also to write the IssueAttack alias. You will also need to set RoomMobs to null whenever you enter a room. If you take Darker's advice you should have no problems handling that and making the stuff for fleeing.
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sat Dec 15, 2001 5:55 pm   
 
ok i read the help files.. i understand every command used but im stuck..

#IF (%pos("sleeping here","%2")|%pos("resting here","%2")|%pos("standing here","%2")){#NOOP}{#LOOP(%ismember("%1",@NumberWords)(#ADDITEM RoomMobs {%word(%trigger,2)}
keeps givin me errors.. says theres a syntax error at {#noop

ive also tried
#IF ((%pos("sleeping here","%2"))|(%pos("resting here","%2"))|(%pos("standing here","%2"))){#NOOP}{#LOOP(%ismember("%1",@NumberWords)(#ADDITEM RoomMobs {%word(%trigger,2)}

and just bout every other possible combination for the pareteses()
im completely stumped..
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sat Dec 15, 2001 6:01 pm   
 
im thinkin it has sumptin to do with these |
cause i got every thing else the way the help files say to put em
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Dec 15, 2001 8:13 pm   
 
quote:

im thinkin it has sumptin to do with these |
cause i got every thing else the way the help files say to put em



aside from the separator used in stringlists, I don't know what else "|" could represent (ie, logical OR, which in C++ is two pipes "||"). Try replacing the pipes with OR and see if it works.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Dec 15, 2001 9:18 pm   
 
The syntax checking is a little more picky then the actual parsing. You have to put in the appropiate spaces. The correct form is:
#IF ((%pos("sleeping here","%2"))|(%pos("resting here","%2"))|(%pos("standing here","%2"))) {#NOOP} {#LOOP(%ismember("%1",@NumberWords) {#ADDITEM RoomMobs {%word(%trigger,2)}
Note the spaces between the IF condition and and the commands it executes. Also a { instead of ( before #ADDITEM. You were right though I was missing a ).
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sat Dec 15, 2001 9:45 pm   
 
if you only knew how long id been trying to figure out what was wrong with that....
thanks
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sun Dec 16, 2001 6:34 am   
 
well you still had errors but i got em all
sept i hit a nouther snag...

(heres what i got so far)
-----------------
#VAR NumberWords {"A"|"Two"|"Three"|"Four"|"Five"|"Six"}
#VAR Mobs {"rabbit"|"deer"|"brown squirrel"}
#VAR RoomMobs {}
#TRIGGER {(%w) ~{@Mobs~} (*).} {#IF ((%pos( "sleeping here", "%2"))|(%pos( "resting here", "%2"))|(%pos( "standing here", "%2"))) {#NOOP} {#LOOP %ismember( "%1", @NumberWords)) {#ADDITEM RoomMobs {%word( %trigger, 2)}}}}
--------------
not sure bout part in red..but i want to imput the text that fired the trig here... is this correct usage?

also is there a way to check against plural other than adding rabbit and rabbits into mobs var?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Dec 16, 2001 7:06 am   
 
Believe it or not %trigger is the correct usage there. Look it up under Predefined Variables, near the bottom of the page you will spot it.
I am not suprised I had a few other errors, I am really good at forgetting things like a close ) here or a close } there. That is why I turn pretty print off, and manually indent everything very carefully.
So you want plurals...I should have thought of it sooner. Change the trigger line thusly:
{(%w) ~{@ZoneMobs~}{s|es|} (*).$
That add a nice little list of plural suffixes, and since most programmers are lazy that will probably even cover any geese I mean gooses on your mud.
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sun Dec 16, 2001 8:58 am   
 
hmm then why doesnt thi trigger store the sting "deer" in the roommobs varible when i recieve this text from mud

------------
By the Forest's Edge
[Exits: east south west]

You are almost in the woods here, with branches overhanging the grass.
Tall oaks and elms crowd the area to the north, with thick bushes growing
in the shadows beneath their thick boughs. To the southeast, you spy a
stout watch tower atop the town wall, from which Chiiron's defenders may
observe happenings in the area.

A deer stands here quietly, sniffing at the air.

<60hp 85e 113mv ESW>
-----------
from what i gather (and ive read alot f the help files now)
this command should match deer with the varible mobs and fire the trigger...the the trigger runs an if statment checkin against bad words..if found nothing is done.. if not the trigger runs a loop for N(matches n with numberwords) to add item deer. to var roommobs... but every time i check the var it contains nothing.....

i dont understand why...
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sun Dec 16, 2001 9:01 am   
 
btw i know it wont store 2 of the same var makin the loop command usless but im workin round that all i want it to do is store1 var right now... cause that means it works
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sun Dec 16, 2001 9:07 am   
 
hehe figured it out... thanks for the help

was the ~'s in the fire command
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Sun Dec 16, 2001 9:11 am   
 
well maybe not... the ~ check for more than 1 var
(insirt assistance here)
..arg..
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Dec 16, 2001 3:38 pm   
 
You were right the should be no ~'s before the set of {}. All I can suggest is doa little proper debugging to try and figure why it isn't working. Add "#SHOW %word(%trigger,2)" as the first command. Then check %1 with your show, then the %pos's. Change the NOOP to "#SHOW got here". Well you get the idea. Just try and it to tell you what is going wrong, then when you find the problem you can take out the SHOW's and be golden.
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Mon Dec 17, 2001 4:33 am   
 
problem solved.... it ws my varible...
the varible is storing the string list with "" so the trig was looking for "deer"
or "rabbit" and since the mud doesnt send ""
the trigger never fired....
how do i get it to remove the quotes
Reply with quote
wetahdid
Beginner


Joined: 06 Dec 2001
Posts: 22

PostPosted: Mon Dec 17, 2001 4:41 am   
 
um im stupid..... just realized it is workin
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