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
Hroomha
Beginner


Joined: 03 Sep 2004
Posts: 11

PostPosted: Mon Apr 17, 2006 11:32 am   

nested #if ...and variable help..please?
 
zmud 6.16


here is the code


Trigger: You have an account balance of (%d) silver
Value:

#if {@currbank=meetbank} {
meetbank=%1
#if {@currbank=spurbank} {spurbank=%1} {}
} {}

#echo @currbank ttl
#if {@currbank=meetbank} {
#echo @meetbank
#if {@currbank=spurbank} {#echo @spurbank}{}
} {}


************************


everything works except the spurbank variable
do I need to do anything to get the %d into the second #if statement?
I tried {spurbank=%%1}..no luck

sorry this is kinda sloppy, not too experienced with
database stuff, so tried it this way...

Thanks for any help,
Rick
_________________
Hroom's Hand

Last edited by Hroomha on Wed Apr 19, 2006 11:55 am; edited 1 time in total
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Mon Apr 17, 2006 2:30 pm   
 
Example output from the mud would be nice and it would help to have a list of which banks you want to include. We could change this so there are not all these nested IF statements. It would be better.
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Mon Apr 17, 2006 2:37 pm   
 
heres a suggestion from the multiple posts you have posted. I havent tested it this is off the top of my head so some adjustments may need to be made. EDIT #VAR BANK with all bank name strings and edit You have arrived in &curbank bank with the proper text string from your mud for when you walk into a bank and it tells you which one. &CURBANK sets the variable so this would replace MEETPOINT for example in your bank entrance trigger.

Code:

#CLASS {banktest}
#ALIAS BANKLIST {
  #CR
  #SHOW "CURRENT BANK BALANCES"
  #FORALL @bank {#ECHO %i "     " @balance%i}
  }
#VARIABLE BANK {meetpoint|spur|market}
#VARIABLE curbank {spur}
#VARIABLE balancespur {1000}
#TRIGGER {You have an account balance of (%d) silver} {#VARIABLE balance@curbank %1}
#TRIGGER {You have arrived in &curbank bank} {}
#CLASS 0
Reply with quote
Hroomha
Beginner


Joined: 03 Sep 2004
Posts: 11

PostPosted: Wed Apr 19, 2006 11:45 am   
 
had to change just one thing...works great!


#FORALL @bank {#ECHO %i " " @{balance%i}}


added a grand total to it ..

#CR
#SHOW "CURRENT BANK BALANCES"
#FORALL @bank {#ECHO %i " " @{balance%i}}
ttl=0
#forall @bank {
#ad ttl @{balance%i}
}
#echo ttl @ttl

thanx again for the help,
Rick
_________________
Hroom's Hand
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Apr 19, 2006 7:25 pm   
 
No Problem glad it helped you out. in addition simplify it with this. No need to cycle through the list twice
Code:

#CLASS {banktest}
#ALIAS BANKLIST {
#VAR ttl 0
#CR
#SHOW "CURRENT BANK BALANCES"
#FORALL @bank {#ECHO %i " " @{balance%i}; #add ttl @{balance%i}}
#echo Total: @ttl
}
#VARIABLE BANK {meetpoint|spur|market}
#VARIABLE curbank {spur}
#VARIABLE balancespur {1000}
#TRIGGER {You have an account balance of (%d) silver} {#VARIABLE balance@curbank %1}
#TRIGGER {You have arrived in &curbank bank} {}
#CLASS 0
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