zmud script problem IMMS please look

An archive of older topics.
Post Reply
Tristan
Posts: 21
Joined: Tue Mar 30, 2010 3:12 am

zmud script problem IMMS please look

Post by Tristan »

Hey guys i really need help with this zmud script please it's driving me insane!!! im trying to make a script that will calculate my bmi for me when i press stat, here is what i have tried but it wont work properly..

#CLASS {BMI}
#VAR feet {0}
#VAR inches {0}
#VAR newfeet {0}
#VAR weight {0}
#VAR totalinches {0}
#VAR bmi {0}
#TRIGGER {height is %1 feet, %2 inches} {
#MATH feet @feet+%1
#math inches @inches+%2
#math newfeet (12*@feet)
#math totalinches @newfeet+@inches
}
#TRIGGER {weight %3 pounds} {
#MATH weight @weight+%3
#math bmi (@totalinches*@totalinches / @weight)<<<---I Think this is were im going wrong
}
#TRIGGER {Your height is (%d) feet, (%d) inches, weight (%d) pounds} {#SUB {Your height is %1 feet, %2 inches, weight %3 pounds, BMI @bmi}
}
#CLASS 0

when i put this in to my command bar its subbing the line but the math is all wrong and ever time i press stat is add more to the bmi...

this is what it looks like:
stat
Your height is 6 feet, 1 inches, weight 183 pounds, BMI 29, weight carried 6.1 lbs, worn: 41.7 lbs.
stat
Your height is 6 feet, 1 inches, weight 183 pounds, BMI 58, weight carried 6.1 lbs, worn: 41.7 lbs.
stat
Your height is 6 feet, 1 inches, weight 183 pounds, BMI 87, weight carried 6.1 lbs, worn: 41.7 lbs.

my bmi is actually 24.1 but as you can see its not showing that :(


this is the bmi formula


Imperial BMI Formula
1 foot = 12 inches
inches┬▓ = inches * inches
( lbs/inches┬▓ )
Table: Imperial BMI Formula BMI =
(weight in pounds * 703 ) / height in inches┬▓



If someone could please help me with this i would be extremely grateful
User avatar
Galnor
Site Admin
Posts: 3023
Joined: Wed Oct 23, 2002 12:37 pm
Location: On The Run
Contact:

Re: zmud script problem IMMS please look

Post by Galnor »

Try this:

Code: Select all

#CLASS {BMI}
#VAR feet {0}
#VAR inches {0}
#VAR newfeet {0}
#VAR weight {0}
#VAR totalinches {0}
#VAR bmi {0}
#TRIGGER {height is %1 feet, %2 inches} {
#MATH feet @feet+%1
#math inches @inches+%2
#math newfeet (12*@feet)
#math totalinches @newfeet+@inches
}
#TRIGGER {weight %3 pounds} {
#MATH weight @weight+%3
#math bmi (@weight*703)/(@totalinches*@totalinches)
}
#TRIGGER {Your height is (%d) feet, (%d) inches, weight (%d) pounds} {#SUB {Your height is %1 feet, %2 inches, weight %3 pounds, BMI @bmi}
}
#CLASS 0
Tristan
Posts: 21
Joined: Tue Mar 30, 2010 3:12 am

Re: zmud script problem IMMS please look

Post by Tristan »

ahh OK i understand whats happening now, your script is working perfectly fine but only for the first stat, when you hit it again it will decrease the bmi and the all the script info will double its self.

Is there a way to make the script reset its #VAR's back to 0 once you push stat the first time??? that would solve this problem i think but im not sure how to do it :( but ill have a fool around with it i guess
Tristan
Posts: 21
Joined: Tue Mar 30, 2010 3:12 am

Re: zmud script problem IMMS please look

Post by Tristan »

OK this seems to be working, and i thank you Galnor because it wouldn't be without your help :).....so here it is, a zmud script that calculates your bmi for you!!

Code: Select all

#CLASS {BMI}
#VAR feet {0}
#VAR inches {0}
#VAR newfeet {0}
#VAR weight {0}
#VAR totalinches {0}
#VAR bmi {0}
#TRIGGER {height is %1 feet, %2 inches} {
  #MATH feet @feet+%1
  #math inches @inches+%2
  #math newfeet (12*@feet)
  #math totalinches @newfeet+@inches
  } 
#TRIGGER {weight %3 pounds} {
  #MATH weight @weight+%3
  #math bmi (@weight*703)/(@totalinches*@totalinches)
  }
#TRIGGER {You are affected by:} {
  #MATH feet {0}
  #math inches {0}
  #math newfeet {0}
  #math weight {0}
  #math totalinches {0}
}
#TRIGGER {Your height is (%d) feet, (%d) inches, weight (%d) pounds} {#SUB {Your height is %1 feet, %2 inches, weight %3 pounds, BMI @bmi}
}
#CLASS 0
User avatar
Galnor
Site Admin
Posts: 3023
Joined: Wed Oct 23, 2002 12:37 pm
Location: On The Run
Contact:

Re: zmud script problem IMMS please look

Post by Galnor »

Cool. :)
Post Reply