|
Jacknam Newbie
Joined: 15 Feb 2002 Posts: 8 Location: USA
|
Posted: Sun Feb 17, 2002 4:20 pm
Triggers |
----------------------------------------------
| SPYNET Wire Service |
|Prices for Univators Jeep|
----------------------------------------------
| Exchange Exchange Tons |
|Planet Buys at Sells at Available|
----------------------------------------------
|Jaw 10 401 5,009 |
|Cartworld 10 537 5,048 |
|Middle 627 |
|Larado 10 422 4,998 |
|Forgottenrelm 1,197 |
|Secrets 519 |
|Togra 738 |
|Tropico 793 |
|Arcona 513 |
|Sloshed 593 |
|Soulless 513 |
|Widgets 425 |
|Telag 582 |
|Ephemeron 589 |
----------------------------------------------
Im hoping the above will look right once its posted, what im trying to do is from whats above i made a trigger that grabs the lowest selling price and the highest buying price...the trigger seems to work here let me post them...
#TRIGGER {|(%w)%s(%x)%s|} {
#IF (@hibuy < %2) {@curplanet = %1;
@hibuy = %2} {DoNothing}} "pricechecker"
#TRIGGER {|(%w)%s10%s(%x)%s(%x)%s|} {@totaltons1 = %3;@totaltons = %replace( @totaltons1, ",", "")
;#IF (@totaltons > @curamount) {#IF (@lowsell > %2) {@curplanet1 = %1
;@lowsell = %2} {DoNothing}} {DoNothing}} "pricechecker"
Basicly it looks as if its working exept its not working completely, Its grabbing the right ones but it seems that some it skips that it should pick up...thats only in a long scroll, if theres only 2 or 3 of those displays you see up there it does perfect but when i stretch it to 30 or more it starts to skip picking up things it shouldnt, is it wishful thinking that zmud can pick up that info and parse it that fast into the variables?
Any help would be appreciated. |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Sun Feb 17, 2002 6:13 pm |
Hmmm, lots of little things:
1. It would be wise to preceed | with a ~ so that it is parsed correctly all the time.
2. When assigning variables (i.e. x=7) leave the @ symbol off. When referencing them use the @ prefix.
3. The #NOOP command can be used to do nothing.
4. If the lowsell number is always less than 1000, use %d instead of %x for more precision.
5. You can place %3 in the %replace function for the sell trigger in quotes.
6. Using the %number function in the sell trigger could be helpful. (Sometimes zMUD scripting is more art than science.)
7. Using boolean operators in your sell trigger will simplify it.
#TRIGGER {~|(%w)%s(%x)%s~|} {
#IF (@hibuy < %2) {curplanet = %1; hibuy = %2} {#NOOP}} "pricechecker"
#TRIGGER {~|(%w)%s10%s(%d)%s(%x)%s~|} {totaltons = %number(%replace( "%3", ",", "")); #IF ((@totaltons > @curamount) & (@lowsell > %2)) {curplanet1 = %1;lowsell = %2} {#NOOP}} "pricechecker"
Troubadour |
|
|
|
Jacknam Newbie
Joined: 15 Feb 2002 Posts: 8 Location: USA
|
Posted: Sun Feb 17, 2002 6:27 pm |
I think i fixed it with just a few simple commands i was missing, For instance i had to take and replace the "," with "" in the 1000's for the prices...which i hadnt done because when it compares 1,000 to 999 it doesnt show 1,000 more than 999 unless you remove the comma, but it seems to work now...
only other problem im having with the whole thing is...those triggers are in a class called pricechecker which is enabled in the alias that ill post...the only way i can figure out how to get the script to wait long enough and then shut off the class is to use the #WAIT command, but sometimes it could take 2 seconds or 12 to get thru the whole thing depending on how many you check and how bad server lag is...Ill post the alias maybe there is a more effecient way of disabling the class without shutting it off too early making the triggers usless?
Heres the Alias..:
#ALIAS DoPriceCheck {@lowsell = 3000
;@hibuy = 0
;#PR tempcommod "Enter the Commodity you would Like to check Prices on:"
;@curcommod = %proper( @tempcommod)
;#PR minamount "Enter the Minimum amount of tannage that you want to check for"
;@curamount = %replace( @minamount, ",", "")
;#YESNO "Would you like to check all available duchies or certain ones?" {All Avail: systems;#wait 2500
;#t+ pricechecker
;#forall @duchylist {c pri @curcommod %i}} {List: DoList}
;#WAIT 10000
;#t- pricechecker}
Any Clue? |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Sun Feb 17, 2002 7:09 pm |
Rather than use #WAIT in your script (and if you must depend on waiting, use #ALARM, not #WAIT), use the dashed lines to demarcate the beginning and end of the text block you wish to analyze. Note that only the last trigger is in the 'pricechecker' class. I don't know what DoList does, so I didn't address it.
#ALIAS DoPriceCheck {
lowsell = 3000
hibuy = 0
#PR tempcommod "Enter the Commodity you would Like to check Prices on:"
curcommod = %proper( @tempcommod)
#PR minamount "Enter the Minimum amount of tannage that you want to check for"
curamount = %replace( @minamount, ",", "")
#YESNO "Would you like to check all available duchies or certain ones?"
{All Avail:systems}
{List:DoList}
}
#TR {^~|Planet Buys at Sells at Available~|$----------------------------------------------$} {#T+ pricechecker}
#TR {^----------------------------------------------$} {#T- pricechecker; #forall @duchylist {c pri @curcommod %i}} "pricechecker"
Troubadour |
|
|
|
|
|
|
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
|
|