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


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Wed Feb 28, 2007 2:42 pm   

Need help setting up seller for shops AOC tales of the lance using Zmud
 
I've been trying to set up a trigger to do this. I read on some other posts on here I've got to set up a script that stores items I loot into a variable string.

When I get to a shop I would like to then sell the items in the string and reset the string. Any help would be greatly appreciated.

Example of the commands I use to get items from corpses get sword corpse. get whip corpse. etc. Example of command I use to sell at shop. sell whip, sell sword. must sell Items 1 at a time (doesn't have sell all.sword comand or anything like that.)

If someone else knows what I need and could list it here It would be great. If not then help setting this up would be great to. I'm a newbie at setting up triggers and stuff. I'm using ver 7.05 zmud.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Feb 28, 2007 2:59 pm   
 
If you're looting manually, something like this would do:

#var LootedItems ""
#trig {You get (%w) from the corpse of} {#additem LootedItems %1}
#alias sellall {#forall @LootedItems {sell %i}}
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Thu Mar 01, 2007 11:30 am   
 
Hey thanx, that works pretty good. Is there anyway to get it to list items by something other than the first name of the description? example you get a heavy mace from the corpse. It picks the word heavy out. When try to sell at shop the shop doesn't register heavy, it needs the word mace. Is their anyway to get it to pick out like say the next word in the phrase? Thanx so much for the help so far, I realy appreciate it.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Mar 01, 2007 2:54 pm   
 
If it's always the last word of the item's description (it almost always will be) you can do this:

#trig {You get *(%w) from the corpse of} {#additem LootedItems %1}

That'll only capture the word that's immediately before "from". I'm surprised this trigger works at all when there's more than one word in the item name, though - %w should only match one word.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Thu Mar 01, 2007 5:55 pm   
 
you should use #var looteditems %additem(...) instead of the #additem to allow duplicates.
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Fri Mar 02, 2007 10:03 pm   
 
#CLASS {autoloot} {enable}
#ALIAS sellall {#forall @loot {sell %i}}
#ALIAS loot {#showdb @loot}
#VAR loot {}
#TRIGGER {You get *(%w) from the corpse of} {#additem Loot %1}
#CLASS 0
This is what I'm working with right now. I tried to use #TRIGGER {You get *(%w) from the corpse of} {%additem Loot %1} but it doesn't work. I just says Huh?!? which is the same text for an unknown command in the mud. So the trig so far won't allow doubles and for some reason it doesn't take a whole word just the last letter of the word prior to the trig (from the corse of) example. The trigger hits on you get a black short sword from the corpse of monster. It will take the d from the end of sword an put it in the string. I'm not sure what to try next. Also I need to figure out how to get it to ignore a couple phrases. example: you get a single gold soverign from the corpse of xxxx, you get 10 gold soverigns from corpse of xxxx, and you get a gold key from the corpse of xxxx. I need these Items but don't need them in my string list because i don't sell them in a shop. Hey I appreciate all the help with this and I'm reading my help files so that hopefully I'll learn to do these things and won't have to bug others.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Mar 02, 2007 11:10 pm   
 
The trigger command needs to be #additem, not %additem. To use the %additem function you need to do

#var loot %additem(%1,@loot)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Sat Mar 03, 2007 12:23 am   
 
#CLASS {autoloot} {enable}
#ALIAS test {%delitem @loot heavy}
#ALIAS sellall {#forall @loot {sell %i}}
#ALIAS loot {#showdb @loot}
#VAR loot {%additem( %1, @loot)}
#TRIGGER {You get *(%w) from the corpse of} {#additem Loot %1}
#CLASS 0
Tried it but all it does is this here. maybe I'm doing something wrong

@loot|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1|%1:
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Mar 03, 2007 12:52 am   
 
It looks like you are trying to do this...
Code:
#ALIAS AddTest {#var loot %additem( heavy, @loot)} "autoloot"
#ALIAS DelTest {#var loot %delitem( heavy, @loot)} "autoloot"
#ALIAS loot {#show %expandlist( @loot, ", ")} "autoloot"
#ALIAS sellall {#forall @loot {sell %i}} "autoloot"
#VAR loot {} {} "autoloot"
#TRIGGER {You get *%s(%w) from the corpse of} {#var loot %additem( %1, @loot)} "autoloot"


Note that I didn't actually clear the list when you sold everything, but I think you can handle that on your own Twisted Evil
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Sat Mar 03, 2007 1:43 am   
 
#ALIAS AddTest {#var loot %additem( heavy, @loot)} "autoloot"
#ALIAS DelTest {#var loot %delitem( heavy, @loot)} "autoloot"
#ALIAS loot {#show %expandlist( @loot, ", ")} "autoloot"
#ALIAS sellall {#forall @loot {sell %i}} "autoloot"
#VAR loot {} {} "autoloot"
#TRIGGER {You get *%s(%w) from the corpse of} {#var loot %additem( %1, @loot)} "autoloot"

this one works good, only thing it detects gold too. Any way to get it not to get say soverigns or coin?


Last edited by knight35966 on Sat Mar 03, 2007 1:50 am; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Mar 03, 2007 1:49 am   
 
Maybe:

#if (%1!="sovereigns") {var loot %additem(%1,@loot)}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Mar 03, 2007 3:34 am   
 
Or

Code:
#ALIAS sellall {#delitem loot "coin";#delitem loot "soverigns";#forall @loot {sell %i}} "autoloot"


Or

Code:
#TRIGGER {You get *%s(%w) from the corpse of} {#if (%1!="sovereigns" and %1!="coin") {var loot %additem(%1,@loot)}} "autoloot"


You get the idea? The sellall alias above will cause less lag over all.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Sat Mar 03, 2007 11:45 pm   
 
This works great thanx all.


Last edited by knight35966 on Sun Mar 04, 2007 10:32 am; edited 1 time in total
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Sun Mar 04, 2007 10:31 am   
 
#CLASS {autoloot}
#ALIAS loot {#show %expandlist( @loot, ", ")}
#ALIAS sellall {#forall @loot {sell %i}}
#VAR loot {} {}
#TRIGGER {You get *%s(%w) from the corpse of} {#if (%1!="sovereigns" and %1!="coin") {#var loot %additem( %1, @loot)}}
#TRIGGER {The shopkeeper now has *%s(%w).} {#var loot %delitem( %1, @loot)}
#TRIGGER {^You receive %d experience points.$} {
examine corpse
get all.gold corpse}
#CLASS 0

Got the trig working good now. I appreciate all the help everyone. I got one last question I hope. For another trigger on this class I'm trying to take sertain Items out of the corpse. This is the text it displays when I examine the corpse I want to loot.

This item is visibly crumbling..
You see nothing special..
When you look inside, you see:
corpse (here) :
a wooden staff
a silver ring
a small pile of gold sovereigns

Now lets say I want to take only the silver ring. I've been trying to use #TRIG {corpse (here) xxxx :}{#IF (%1=ring) {get ring corpse}}. I don't know what expresions I should use. The text from corpse (here) : down is like they hit enter when typing it into the display. Also a good referance for pattern's would be great. I've read the help file and just can't understand it. If there is no better explanation of them and how they need to be combined could you give me a few hints or pointers. Thanx for all the great help everyone and hopefully I won't have to keep bothering you guys.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Mar 04, 2007 3:05 pm   
 
#var ThingsIWant ""
#trig "AutoGetTrig" {^corpse ~(here~) :} {}
#cond {(%w)$} {#if (%ismember(%1,@ThingsIWant)) {get %1}} {looplines|param=10}

Also, you could add a command to your prompt trigger:

#state AutoGetTrig 0

to top the second part that checks whether you want the item continuing after the prompt. @ThingsIWant is a stringlist with one-word names of items you want to get.
Reply with quote
knight35966
Beginner


Joined: 28 Feb 2007
Posts: 11
Location: Alabama

PostPosted: Sun Mar 04, 2007 9:20 pm   
 
#CLASS {autoloot|ThingsIWant}
#VAR ThingsIWant {"adam|whip|sterling|mint|potion|wand|ages|ruby|staff|"}
#TRIGGER "AutoGetTrig" {^corpse ~(here~) :} {}
#COND {(%w)$} {#if (%ismember( %1, @ThingsIWant)) {get %1 corpse}} {looppat|param=1}
#CLASS 0

Had to change it a little bit but works great now thanx. I've learned a lot from making these triggers here thanx alot all of you.
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