|
pkeeper Newbie
Joined: 04 Jun 2006 Posts: 2
|
Posted: Sun Jun 04, 2006 12:10 am
Inventory trigger |
Hello,
I have been struggling to code what is likely something very simple that I am just inept at doing! So I need some help.
I want to be able to probe a flower pot.. use the inventory list to identify the items and pull them out by their number, not their name.. and then drop and price them.
Here is the output:
A clay flowerpot is holding:
"wisp139061" a thorny evening wisp
So from that I would like to:
get 139061 from pot
drop 139061
price 139061 100
Any help?
Thank you. |
|
|
|
Glorida Newbie
Joined: 10 Mar 2006 Posts: 7
|
Posted: Sun Jun 04, 2006 12:44 am |
It isn't too hard, but I've been doing this a while, here's some advice for everyone: Don't give up, the help files are very handy....Anyway here goes:
#trigger {"(%w)(%d)" %3} {get %2 from pot;drop %2;price %2 100}
If you want to make the 100 variable, just make an alias to set it, something like
#alias {money} {#var value %1}
then instead of 100 in the trigger use: @value
Answer your question?
--Note: This will get, drop, and price everything that matches that string. So if you want to do only specific items, make a list of them.
Example:
#additem itemlist wisp
#additem itemlist sword
Then your trigger should be something like:
#trigger {"(%w)(%d)" %3} {#forall @itemlist {#IF (%1 = %i) {get %2 from pot;drop %2;price %2 100}}
--Basically, everytime it comes across a "word1590" string, string, it will run thru the list of words you put into it, and if the word matches the wordlist, it will then execute the get/drop/price, otherwise it does nothing... I Assume this is what you were meaning with your question.
Glorida |
|
|
|
pkeeper Newbie
Joined: 04 Jun 2006 Posts: 2
|
Posted: Sun Jun 04, 2006 1:16 am |
That worked perfectly and now gives me some education as well.
Thank you for taking the time to help. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sun Jun 04, 2006 1:33 am |
Look up %ismember and use that in place of #forall it will be more effecient.
|
|
_________________ Taz :) |
|
|
|
Glorida Newbie
Joined: 10 Mar 2006 Posts: 7
|
Posted: Sun Jun 04, 2006 2:50 am |
Taz is correct, I actually had written the second script a different way, before I edited my post and deleted some stuff, so %ismember is a better way in this particular case, but in my original post it was more useful to use forall. You always forget somethings, sometimes, I think
Glorida |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sun Jun 04, 2006 8:53 am |
Like a closing brace
|
|
_________________ Taz :) |
|
|
|
|
|