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
Taishar
Novice


Joined: 23 Jul 2001
Posts: 47
Location: USA

PostPosted: Wed Jun 18, 2003 1:37 am   

Another 6.4 trigger that isn't working in 6.62...
 
Err, actually, its a couple aliases... the first is



#VAR loot.coins 0
#VAR loot.box 0
#VAR loot.coffer 0
#VAR loot.chest 0
#VAR loot.pouch 0
#VAR loot.bag 0
#VAR loot.sack 0
#VAR contents %replace( @contents, " ", "|")
#VAR contents %replace( @contents, ",", "")
#FORALL @contents {
#IF (%i="coin") {#ADD loot.coins 1}
#IF (%i="coins") {#ADD loot.coins 1}
#IF (%i="box") {#ADD loot.box 1}
#IF (%i="coffer") {#ADD loot.coffer 1}
#IF (%i="chest") {#ADD loot.chest 1}
#IF (%i="pouch") {#ADD loot.pouch 1}
#IF (%i="sack") {#ADD loot.sack 1}
#IF (%i="bag") {#ADD loot.bag 1}
}
grab


Where contents is a string of random junk that is on the floor that I broke up into a string list:


#VAR contents {.||||A|gold|coin|a|bronze|bastard-sword|a|platinum|cutlass|and|a|silver|corkscrew|are|here.}


Now, for some reason, the trigger that is supposed to count how many of each item there is, isn't working... when it goes through that string, it says there's like 3 of each container and 7 coins.

When it works properly, it'd just show 2 coins.

The grab in the first alias is this one:


#VAR stuff {}
#IF (@loot.box) {#LOOP @loot.box {#VAR stuff {%addItem( "box", @stuff)}}}
#IF (@loot.chest) {#LOOP @loot.chest {#VAR stuff {%addItem( "chest", @stuff)}}}
#IF (@loot.coffer) {#LOOP @loot.coffer {#VAR stuff {%addItem( "coffer", @stuff)}}}
#IF (@loot.pouch) {#LOOP @loot.pouch {#VAR stuff {%addItem( "pouch", @stuff)}}}
#IF (@loot.bag) {#LOOP @loot.bag {#VAR stuff {%addItem( "bag", @stuff)}}}
#IF (@loot.sack) {#LOOP @loot.sack {#VAR stuff {%addItem( "sack", @stuff)}}}
#IF (@loot.coins) {#LOOP @loot.coins {#VAR stuff {%addItem( "coin", @stuff)}}}
#delitem 0 stuff
#IF @stuff {
#T+ Getting
#VAR loot.active 1
}

yeah, its messy... but wasn't sure how else to do it, heh. Basically just adds them all to a string list, so that another trigger and go through and grab each one in turn and remove it from the list before going onto the next.

When it all works properly, it'd take the treasure, break it up into a string list, then count how many occurences of coins, boxes, etc and store it all in the Loot variable... the grab alias would then assemble a string list of items to pick up. It all worked in 6.4, but none of it is now :-/

Thanks in advance... I know those triggers are really messy, heh.

Dan


The unstained tower breaks and bends knee to the forgotten sign. The seas rage, and storm clouds gather unseen. What was exalted is cast down; what was cast down is raised up. Order burns to clear his path.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jun 18, 2003 12:11 pm   
 
Since %i is expanded early now, you have to treat it as if it were %1, %2, etc. Surround the %i's with double quotes.

Kjata
Reply with quote
Taishar
Novice


Joined: 23 Jul 2001
Posts: 47
Location: USA

PostPosted: Wed Jun 18, 2003 2:35 pm   
 
Ahh, alright, works like a charm : )

Thanks

The unstained tower breaks and bends knee to the forgotten sign. The seas rage, and storm clouds gather unseen. What was exalted is cast down; what was cast down is raised up. Order burns to clear his path.
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