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


Joined: 15 Nov 2004
Posts: 18

PostPosted: Thu Jun 23, 2005 6:52 pm   

Help with a script
 
I need to know if triggers can pick out things from a list and identify them.
Example I want to collect only certain things from corpses....

Here is an example

The corpse of the Pawn of the Black Court holds:
some Black Pawn Armour
a Black Pawn's Spear
a Black Pawn's Shield
a Black Pawn's Cloak
jewel
a Black Pawn's Helmet
a pair of Black Pawn's Leggings
a pair of Black Pawn's Boots
a pair of Black Pawn's Gloves
a pair of Black Pawn's Sleeves
a Black Pawn's Cape
a Black Pawn's Belt
( 2) a Black Pawn's Bracer
amulet

I only want to pick up the amulets and jewels can I do that with a trigger that recognizes that this is a corpse? IE I dont want to trigger off of amulet and jewel in my inv....

Thanks
-T
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Thu Jun 23, 2005 7:30 pm   
 
you can use classes that will turn on when they see the corpse and off when they are done, look it up in the helpfiles. ex: #T- turns off a trigger. if you look it over and you feel that it is to much trouble to figure out, there are plenty here who can help you, and I would be willing to write the script for you latter tonight
chael
email: nimbuscogitare@hotmail.com
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Jun 23, 2005 7:32 pm   
 
Yes you can. You'll need to trigger off your prompt to stop collecting though

You probably want something along the lines of...

#trigger {The corpse of (*) holds:} {corpsecollect = %1}
#TRIGGER {({amulet|jewel})} {#IF (@corpsecollect != %null) {get %1 from corpse of @corpsecollect}}
#trigger {YourPrompt} {corpsecollect = %null}

So when you see a corpse it'll make a note of what the corpse is, then as you're looking through it it'll grab anything you want inside
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Thu Jun 23, 2005 8:05 pm   
 
you could also send a command after the the command to look in the corpse
look in corpse
emote is finished lookin at the corpse

I used this method when for my mud mapper script all the triggers it worked well
Reply with quote
DeReP
Adept


Joined: 14 Jun 2003
Posts: 222
Location: Chile

PostPosted: Thu Jun 23, 2005 10:01 pm   
 
#TRIGGER {The corpse of * holds:} {#T+ "Collect Trigger"}
#COND {^$} {#T- "Collect Trigger"}
#TRIGGER "Collect Trigger" {^({Jewel|amulet})} {get %1 corpse} {} {disable}
Reply with quote
thalor42
Beginner


Joined: 15 Nov 2004
Posts: 18

PostPosted: Fri Jun 24, 2005 1:38 pm   
 
Ok both ways suggested worked well! Thanks! Im getting the hang of it....now I would like to know if that same theory can be used to get items that are colored differently.....

The code for Red is \033[31;1m

Can a trigger be made to respond to raw data coming in? So if the list now looks like this....

The corpse of A visiting merchant holds:
(Glowing) A silver band
wooden spear
thin cap

That the trigger set will pick up the thin cap.

Thanks in advance for the knowledge you guys have!
Reply with quote
thalor42
Beginner


Joined: 15 Nov 2004
Posts: 18

PostPosted: Fri Jun 24, 2005 2:13 pm   
 
One small detail is there a way to not have the tigger fire on Command echos? I like having them on and when I do it sends it into a loop. Just wondering.
Reply with quote
thalor42
Beginner


Joined: 15 Nov 2004
Posts: 18

PostPosted: Fri Jun 24, 2005 2:56 pm   
 
Forget that last item I found the check box to turn that off!

Thanks!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Jun 24, 2005 11:45 pm   
 
To answer your color question you need to use a color trigger (%e is the escape char)
to get the exact color codes easily copy the text from the mud, open the settings editor, create a new trigger, select the ansi color option, and shit-insert in the pattern box (pasteing from the mouse popup menu wont work)


#TRIGGER "Red_Color" {^%e[1;31m(*)} {get %1} "" {color}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
thalor42
Beginner


Joined: 15 Nov 2004
Posts: 18

PostPosted: Sat Jun 25, 2005 9:47 pm   
 
Thanks that worked. I'm learning something new everytime. How bout this...

What If I didnt want to pick up things that were red and had the word white in it, but did want to pick up everything else that was red... IE

a sash
a white bar of gold
a green piece of silk
a yellow flower

How would I get it to only pick up the sash?

Thanks for helping me learn!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jun 26, 2005 7:50 am   
 
#TRIGGER "Red_Color" {^%e[1;31m(*)} {
#IF !%pos("white","%1") {get %1}
} "" {color}
_________________
Zmud Support Library
Zmud Knowledge Base
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