|
Dravon Beginner
Joined: 05 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Mar 16, 2004 11:28 pm
question on a trigger |
I am useing 7.04 on win 98 and useing the following to sell items
when i look in to a container. I am running into a bit of problem with some items that the names one thing but sell as another. Arrows is a good example. when i type in selljunk 2 backpack I see this
look in 2 back
Inside the open large leather backpack you see a quiver of wooden arrows, a quiver of wooden arrows, and a quiver of wooden arrows.
>
get arrows from 2 back
I don't see any "arrows" in there!
>
l in 2 back
>
Nothing to do!
Now if I change my variable junkitems arrow to arrows I see this
look in 2 back
Inside the open large leather backpack you see a quiver of wooden arrows, a quiver of wooden arrows, and a quiver of wooden arrows.
>
l in 2 back
>
Selling approximately 3 items...
get arrows from 2 back
shop haggle sell arrows confirm
I don't see any "arrows" in there!
get arrows from 2 back
I don't see what you are referring to.
I don't see any "arrows" in there!
get arrows from 2 back
So I need a way for it to se that the arrows is in there but sell it as arrow. Thanks for any help you can give me.
Ill paste the script below
#CLASS {CapJunk} {disable}
#TRIGGER {^There is nothing} {
#T- CapJunk
#ECHO Nothing to do.
}
#TRIGGER {^Inside the * you see (*).} {
#GAG
#VAR JunkStuff ""
#T- CapJunk
#LOOP %numwords( "%1") {
#VAR currjunk %replace( %word( "%1", %i), ",", "")
#IF (%ismember( @currjunk, @JunkItems)>0) {@JunkStuff = %additem( @currjunk, @JunkStuff)}
}
#IF (%numitems( @JunkStuff)>0) {
#ECHO Selling approximately %numitems( @JunkStuff) items...
#T+ selljunk2
#VAR currjunk %pop( JunkStuff)
get @currjunk from @container
shop haggle sell @currjunk confirm
} {#ECHO Nothing to do!}
}
#CLASS 0
#CLASS {selljunk2} {disable}
#ALIAS stop {
#T- selljunk2
#ECHO Junk selling stopped
}
#TRIGGER {^{You step forward|I don't see any}} {
#IF (%numitems( @JunkStuff)>0) {
#VAR currjunk %pop( JunkStuff)
get @currjunk from @container
#wa 5000
shop haggle sell @currjunk confirm
} {
#ECHO Done!
#wa 5000
look in @container
#T- SellJunk2
}
}
#CLASS 0
#ALIAS SellJunk {
#T+ CapJunk
#VAR container "%-1"
l in @container
}
#VAR junkitems {butcher|khopesh|arrow|hammer|lance|talon}
#CLASS 0 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Mar 17, 2004 4:12 am |
"quiver" maybe?
Other than simple changes like that, a major rewrite will probably be needed. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Mar 17, 2004 8:09 pm |
Recommendation: Don't use #GAG in scripts that haven't been tested or that are giving you trouble. It's harder to debug scripts when you don't see what's going on.
Recommendation: When you need one word (arrows) for MUD output and a different word (arrow) for MUD input, use a record-variable to pair them up.
#CLASS {CapJunk} {disable}
#TRIGGER {^There is nothing} {
#T- CapJunk
#ECHO Nothing to do.
}
#TRIGGER {^Inside the * you see (*).} {
;#GAG
#VAR JunkStuff ""
#T- CapJunk
#LOOP %numwords( "%1") {
#VAR currjunk %replace( %word( "%1", %i), ",", "")
#IF (%iskey( @JunkItems, @currjunk) > 0) {@JunkStuff = %additem( %db( @JunkItems, @currjunk), @JunkStuff)}
}
#IF (%numitems( @JunkStuff)>0) {
#ECHO Selling approximately %numitems( @JunkStuff) items...
#T+ selljunk2
#VAR currjunk %pop( JunkStuff)
get @currjunk from @container
shop haggle sell @currjunk confirm
} {#ECHO Nothing to do!}
}
#CLASS 0
#CLASS {selljunk2} {disable}
#ALIAS stop {
#T- selljunk2
#ECHO Junk selling stopped
}
#TRIGGER {^{You step forward|I don't see any}} {
#IF (%numitems( @JunkStuff)>0) {
#VAR currjunk %pop( JunkStuff)
get @currjunk from @container
#wa 5000
shop haggle sell @currjunk confirm
} {
#ECHO Done!
#wa 5000
look in @container
#T- SellJunk2
}
}
#CLASS 0
#ALIAS SellJunk {
#T+ CapJunk
#VAR container "%-1"
l in @container
}
#ADDKEY JunkItems {butcher=butcher|khopesh=khopesh|arrows=arrow}
#ADDK JunkItems {hammer=hammer|lance=lance|talon=talon}
#CLASS 0
EDIT: Changed #IF (%iskey( @JunkItems, @currjunk) > 0) {@JunkStuff = %additem( %db( @JunkStuff, @currjunk), @JunkStuff)}
to #IF (%iskey( @JunkItems, @currjunk) > 0) {@JunkStuff = %additem( %db( @JunkItems, @currjunk), @JunkStuff)} |
|
|
|
Dravon Beginner
Joined: 05 Jan 2002 Posts: 29 Location: USA
|
Posted: Fri Mar 19, 2004 3:32 pm |
Thanks! Ill give it a try
|
|
|
|
Dravon Beginner
Joined: 05 Jan 2002 Posts: 29 Location: USA
|
Posted: Sun Mar 28, 2004 1:41 pm |
hmm this doesnt seem to work at all this way. It will give me the message done even if there are stuff in there that can be sold. let me know what info you need to help you figure this one out thanks!
Inside the open dirty bag you see a quiver of painted yew arrows and a fresh baked apple pie. is what it look into. and it just says nothing to do. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Mar 28, 2004 5:43 pm |
db referenced the wrong variable. Script corrected above.
|
|
|
|
|
|
|
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
|
|