lbs to kg script

... A place to ask for help on any topic whether it be starting out to player killing to IT issues.
Alison
Posts: 821
Joined: Mon Mar 30, 2015 3:09 am
Location: South Africa
Contact:

lbs to kg script

Post by Alison » Mon Jul 24, 2017 4:05 am

Im looking to change you are carrying xx lbs to you are carrying xx kgs . Atm 1 lbs is 0.454 kg. If anyone can help pls.

Maeglin
Posts: 76
Joined: Wed Apr 15, 2015 9:47 pm

Re: lbs to kg script

Post by Maeglin » Mon Jul 24, 2017 4:33 am

Might want to post what client you are using. This shouldn't be too hard in CMUD. I use one to add up my defense, but you have to replace the whole line.

Aardvolf
Posts: 50
Joined: Sat Jan 02, 2016 7:25 pm

Re: lbs to kg script

Post by Aardvolf » Mon Jul 24, 2017 11:03 am

I don't know about cMUD but I know zMUD does not handle fractions. It truncates anything beyond a decimal. Why do you need it in kg?

Taziar
Posts: 961
Joined: Sat Mar 21, 2015 10:28 pm

Re: lbs to kg script

Post by Taziar » Mon Jul 24, 2017 11:15 am

Aardvolf wrote:I don't know about cMUD but I know zMUD does not handle fractions. It truncates anything beyond a decimal. Why do you need it in kg?
To use decimals in zMUD you use the %float function.

Naerin
Posts: 313
Joined: Sat May 23, 2015 12:29 pm

Re: lbs to kg script

Post by Naerin » Mon Jul 24, 2017 6:09 pm

For Zmud:

#CLASS {LbstoKg}
#TRIGGER {and you weigh (%d).(%d) lbs.$} {
#MATH weigh %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR weighkg {%format( 1, %eval( @weigh*0.454))}
#SUB {and you weigh @weighkg kg.}
}
#TRIGGER {^You are carrying (%d).(%d) lbs} {
#MATH carry %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR carrykg {%format( 1, %eval( @carry*0.454))}
#SUB {You are carrying @carrykg kg}
}
#TRIGGER {and wearing (%d).(%d) lbs} {
#MATH wear %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR wearkg {%format( 1, %eval( @wear*0.454))}
#SUB {and wearing @wearkg kg}
}
#CLASS 0

Edit: Thanks to Maeglin for catching the error.
Last edited by Naerin on Wed Jul 26, 2017 6:18 pm, edited 2 times in total.

Alison
Posts: 821
Joined: Mon Mar 30, 2015 3:09 am
Location: South Africa
Contact:

Re: lbs to kg script

Post by Alison » Tue Jul 25, 2017 12:57 am

thanks. And i use cmud. My mind is used to using kg's and not pounds.

Grabel
Posts: 204
Joined: Thu May 21, 2015 8:27 pm

Re: lbs to kg script

Post by Grabel » Tue Jul 25, 2017 8:06 am

I think my mind would go crazy if i would use kg, lugging around 8 kg sword etc.

Naerin
Posts: 313
Joined: Sat May 23, 2015 12:29 pm

Re: lbs to kg script

Post by Naerin » Tue Jul 25, 2017 5:55 pm

Can someone adapt my script for Cmud so that Alison can use it?

Maeglin
Posts: 76
Joined: Wed Apr 15, 2015 9:47 pm

Re: lbs to kg script

Post by Maeglin » Wed Jul 26, 2017 1:20 am

If the zmud version doesn't work with CMUD, I'll try to work on it later tonight.

Maeglin
Posts: 76
Joined: Wed Apr 15, 2015 9:47 pm

Re: lbs to kg script

Post by Maeglin » Wed Jul 26, 2017 6:15 pm

Naerin wrote:For Zmud:

#CLASS {LbstoKg}
#TRIGGER {and you weigh (%d).(%d) lbs.$} {
#MATH weigh %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR weighkg {%format( 1, %eval( @wearing*0.454))} <------typo
#SUB {and you weigh @weighkg kg.}
}
#TRIGGER {^You are carrying (%d).(%d) lbs} {
#MATH carry %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR carrykg {%format( 1, %eval( @carry*0.454))}
#SUB {You are carrying @carrykg kg}
}
#TRIGGER {and wearing (%d).(%d) lbs} {
#MATH wear %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR wearkg {%format( 1, %eval( @wear*0.454))}
#SUB {and wearing @wearkg kg}
}
#CLASS 0
This works fine in CMUD, but there was a typo in the body weight trigger. Fixed below. I actually really dig this simple little script. Thanks for thinking about the idea, Alison.

#CLASS {LbstoKg}
#TRIGGER {and you weigh (%d).(%d) lbs.$} {
#MATH weigh %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR weighkg {%format( 1, %eval( @weigh*0.454))}
#SUB {and you weigh @weighkg kg.}
}
#TRIGGER {^You are carrying (%d).(%d) lbs} {
#MATH carry %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR carrykg {%format( 1, %eval( @carry*0.454))}
#SUB {You are carrying @carrykg kg}
}
#TRIGGER {and wearing (%d).(%d) lbs} {
#MATH wear %eval( %float( %1) + %norm( %eval( %2/%float( 10))))
#VAR wearkg {%format( 1, %eval( @wear*0.454))}
#SUB {and wearing @wearkg kg}
}
#CLASS 0
* HP:Healthy MV:Fresh > TICK IN 5 SECONDS.
stat
You are a 432 year old male seanchan hunter.
Your height is 6 feet, 0 inches, and you weigh 178.0 lbs.
You are carrying 1.6 lbs and wearing 49.1 lbs, very light.
Your base abilities are: Str:19 Int:15 Wil:16 Dex:19 Con:19 Statsum: 88.
Offensive bonus: 96, Dodging bonus: 76, Parrying Bonus: 56, Defense: 132
Your mood is: Wimpy. You will flee below: 196 Hit Points
Your posture is: Defensive.
You are wanted by: Andor Tar Valon Illian Fal Dara Tear Amador Maradon Cairhien Children of Light Red Eagles Thiefbane Wolves Bandar Eban Mayene Tremalking Far Madding
Your armor absorbs about 58% on average.

You are subjected to the following effects:

* HP:Healthy MV:Fresh > stat
You are a 432 year old male seanchan hunter.
Your height is 6 feet, 0 inches, and you weigh 80.8 kg.
You are carrying 0.7 kg and wearing 22.3 kg, very light.
Your base abilities are: Str:19 Int:15 Wil:16 Dex:19 Con:19 Statsum: 88.
Offensive bonus: 96, Dodging bonus: 76, Parrying Bonus: 56, Defense: 132
Your mood is: Wimpy. You will flee below: 196 Hit Points
Your posture is: Defensive.
You are wanted by: Andor Tar Valon Illian Fal Dara Tear Amador Maradon Cairhien Children of Light Red Eagles Thiefbane Wolves Bandar Eban Mayene Tremalking Far Madding
Your armor absorbs about 58% on average.

You are subjected to the following effects:
EDIT:
One nitpicky thing if you care. If you initializes all of the variables at the start of the class, they won't spam up your general folder.

#CLASS {LbstoKg}
#Var weigh 0
#Var wearing 0
etc
#Triggers etc
#Class 0

Post Reply