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
Yuri Kiseki
Newbie


Joined: 10 Jun 2002
Posts: 6

PostPosted: Fri Jun 14, 2002 8:21 pm   

Storing a different variable.
 
This trigger stores the variable that's set,
but is there any possible way for it to store a different variable for it to be stored then fired?

#ALIAS bandit {take all.moccasins bag;take all.robes bag;take all.shortsword bag;take all.boots bag;take all.rags bag;take all.legplates bag;take all.chainmail bag;take all.broadsword bag;take all.hat bag;take all.shortsword bag;take all.warhammer bag}
#VAR selllist {a jagged stone warhammer|a pair of hide moccasins|a large broadsword|a pair of iron legplates|a pair of large leather boots|a pair of studded leather boots|a set of iron chainmail|a suit of leather rags|an iron shortsword|some black cloth robes|a blue hat|a short black dagger}
#TRIGGER {^You get ({@selllist}) from a bag sewn from strands of starweed.} {#VAR sellist %1;sell %1;put all.coin sack}

Example: It tries to sell a jagged stone warhammer, but the keyword is warhammer. Might there be a way to change the variable so it isn't "sell a jagged stone warhammer", but "sell warhammer"? And so on? Thank you for your input. :)
Reply with quote
int 21h
Newbie


Joined: 14 Jun 2002
Posts: 8

PostPosted: Fri Jun 14, 2002 8:39 pm   
 
Just change the original trigger that adds items into that list, so that it only captures * (%w).

For example:
If your mud sent this:

You get a bright blue robe from the corpse of Satan.

Make the trigger:
#trigger {You get * (%w) from the corpse of *} {#var selllist %addItem(%1,@selllist)}

That would store 'robe' in the list. Notice how I use %addItem instead of #addi, because you want duplicates in the list (in case you have two of one item).

---
I can show you the door, but only you can open it.

ArcticMUD (http://mud.arctic.org || telnet://mud.arctic.org:2700)
Reply with quote
Yuri Kiseki
Newbie


Joined: 10 Jun 2002
Posts: 6

PostPosted: Sat Jun 15, 2002 3:44 am   
 
Hmm... only thing is that those items on the list is the only things that I want to sell at the moment. That trigger will indiscrimiatly add to everything I take from a corpse, right?
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Sat Jun 15, 2002 6:20 am   
 
Sell one type of item at a time, so that you don't inadvertently sell any items that have multiple names.

*** DISCLAIMER: I have not tested this script nor used this kind of script. I wrote this entirely on the web browser, so I hope this script will at least give you a general idea.
1) A string list with all the items to take out of your bag.

#var takeoutlist {warhammer|moccasins|sword|legplates|boots|chainmail|rags|robes|hat|dagger}
2) Your sell list.
#var selllist {a jagged stone warhammer|a pair of hide moccasins|a large broadsword|a pair of iron legplates|a pair of large leather boots|a pair of studded leather boots|a set of iron chainmail|a suit of leather rags|an iron shortsword|some black cloth robes|a blue hat|a short black dagger}
3) A trigger to check each item taken out. Put a 2.item or some way to skip the item if it does not match.
#trigger {^You get (*) from a bag sewn from strands of starweed.} {
#var itemlist {%additem(%if("%1" =~ "{@selllist}",1,0),@itemlist)}
}
4) An Alias to take out one set of items. Initialize the sell list to for a fresh list of items from the trigger.
#alias takeout {
#var itemlist {}
take all.%item(takeoutlist,@takeoutptr) bag
say YOUR-STOP-MARKER-%item(takeoutlist,@takeoutptr)-THIS-COULD-BE-YOUR-PROMPT
}
5) An Alias to start this process. Initialize a pointer to point to the first item on your takeoutlist.
#alias bandit {
#var takeoutptr 1
takeout
}
*** This assumes that 2.rag is the second rag in your inventory.
*** This also assumes that your inventory is LIFO - Last In First Out.
6) Trigger on the marker to restart the process on the next item in your take out list. Initialize the skip counter.
#trigger {THIS-COULD-BE-YOUR-PROMPT} {
#if %numitems(@itemlist) {
#var skipcounter 1
#loop %numitems(@itemlist),1 {
#if %item(@itemlist,%i) {
sell %if(@skipcounter!=1,@{skipcounter}.)%item(takeoutlist,@takeoutptr)
} {
#add skipcounter 1
}
}
}
put all.coin sack
#if (%numitems(@takeoutlist) > takeoutptr) {
#add takeoutptr 1
takeout
}
}
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