|
ShadowsPirate Beginner
Joined: 15 Jun 2007 Posts: 17
|
Posted: Thu Apr 24, 2008 12:58 am
multi-line variable capture |
Background:While picking herbs and toxins or whatever, you have a command to tell you whats in your area. The only bad thing is that it gives a general message and then says how many of each, each with its own line. I would like to be able to capture these numbers, then determine which is bigger and pick it and use an alias, then if it is above a certain number continue picking. And I think I will need some way to convert from word numbers to number-numbers for the checking to work, which I imagine won't be alll that fun.
Commands and their showings:
Herbs:with nothing in the location.
Quote: |
Your search of your surroundings reveals the following herbs growing here... |
With one.
Quote: |
Your search of your surroundings reveals the following herbs growing here...
Fifty-six woodsage.
|
Looks same for with 2, and with 3.
The prompt that will always be at the end.
Quote: |
(%d)/(%d)h (%d)/(%d)m (%d)xp (*)~> |
I was thinking a WHILE would work, but I couldn't figure it out for the life of me. |
|
|
|
meyn Beginner
Joined: 06 Mar 2008 Posts: 27
|
Posted: Thu Apr 24, 2008 12:39 pm |
Try this,
I got the number converter from on the forum, it only goes to ninety-nine so if you need higher it will need to be added.
This script turns your triggers on, after the 'Your search of your surroundings reveals the following herbs growing here' is received and turns them back off agian when '(%d)/(%d)h (%d)/(%d)m (%d)xp (*)~>' is received.
You need to set the minimumnumber and where to put the herb before you use
Code: |
#CLA {NumberConverter}
#var numbers {one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen}
#addkey HNumbers {twenty=20|thirty=30|forty=40|fifty=50|sixty=60|seventy=70|eighty=80|ninety=90}
#func getNum {%if( %pos( "-", %1)>0, %eval( %db( @hnumbers, %left( %1, %pos( "-", %1)-1))+%ismember( %right( %1, %pos( "-", %1)), @numbers)), %if( %iskey( @hnumbers, %1), %db( @hnumbers, %1), "")%if( %ismember( %1, @numbers), %ismember( %1, @numbers)))}
#alias showNum {#show @getNum(%1)}
#CLA {HerbSearch}
#AL sortherb {
#SHOW %ansi(bold,white)The most abundant herb is @mainherb
pick @mainherb
***Enter what you want to do with herb here***
look
}
#TR {Your search of your surroundings reveals the following herbs growing here} {#T+ HerbList;#VAR bestsofar 0}
#COND {(%d)/(%d)h (%d)/(%d)m (%d)xp (*)~>} {#T- HerbList;sortherb}
#CLA 0
#CLA {Herbsearch|HerbList}
#VAR minimumnumber {*** Set to number to not bother picking anymore***}
#AL highest {
#IF (@bestsofar<@amount AND @minimumnumber<@amount) {
#VAR bestsofar @amount
#VAR mainherb @herb
}
}
#TR {^&amount woodsage} {#VAR amount @getnum(@amount);#VAR herb {woodsage};highest}
#TR {^&amount broomweed} {#VAR amount @getnum(@amount);#VAR herb {broomweed};highest}
#TR {^&amount deadly nightshade} {#VAR amount @getnum(@amount);#VAR herb {nightshade};highest}
#CLA 0 |
I put a couple of extra triggers in to show setup, change them to what you need and enjoy! |
|
|
|
|
|
|
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
|
|