Math action bug

A forum for discussing map making ideas and problems for the Myth series.
Post Reply
hmp
Posts: 146
Joined: Fri Dec 14, 2007 3:00 am

Math action bug

Post by hmp »

The "Result Fraction" parameter in the Math action is supposed to store the output as a fraction, but actually seems to store it as an integer. It's not too much of a problem since you can still store the result as a fraction in another action, but it was giving me a headache trying to figure out what was wrong with my script.
User avatar
juliocpaes
Posts: 1263
Joined: Mon Feb 14, 2011 12:07 am
Location: Madrigal - Brazil
Contact:

Re: Math action bug

Post by juliocpaes »

hmp wrote:The "Result Fraction" parameter in the Math action is supposed to store the output as a fraction, but actually seems to store it as an integer. It's not too much of a problem since you can still store the result as a fraction in another action, but it was giving me a headache trying to figure out what was wrong with my script.
already to figure out what was wrong with your script ?
Myrd
Site Admin
Posts: 4031
Joined: Fri Mar 19, 2004 10:17 pm

Re: Math action bug

Post by Myrd »

I looked at the code and it seems like it should work. Could you provide a test map where you're seeing it not working?
hmp
Posts: 146
Joined: Fri Dec 14, 2007 3:00 am

Re: Math action bug

Post by hmp »

Here you go

https://dl.dropboxusercontent.com/u/150 ... 20test.zip

There are two sets of map actions set up - one for the right trow and the other for the left. Both should set their health fractions to 0.7, however the one on the right does not, it sets it to 0 (or almost). The difference is the one on the right uses result fraction (refx) and the actions for the left one place the result in a different action using destination action identifier and destination parameter.

You can also look in loathing and see that the parameter type for result fraction/refx is "integer" instead of "fixed".

Also I think when I first discovered this I tried manually changing it from integer to fixed and it still didn't work.

Image
User avatar
juliocpaes
Posts: 1263
Joined: Mon Feb 14, 2011 12:07 am
Location: Madrigal - Brazil
Contact:

Re: Math action bug

Post by juliocpaes »

@ hmp

but in "edit map aciton" you set "initially active" ? which you are to use "expiration mode" ?
hmp
Posts: 146
Joined: Fri Dec 14, 2007 3:00 am

Re: Math action bug

Post by hmp »

Julio, that is not the actual script, it was just to show the parameter in question defaults to integer type.
Myrd
Site Admin
Posts: 4031
Joined: Fri Mar 19, 2004 10:17 pm

Re: Math action bug

Post by Myrd »

Ah. I think it's a problem with the Loathing default. The code indeed tries to use the type of the field to set the value, so if the field type is integer, it will set it as integer. I *think* changing the field type to fixed will work correctly. The fix should be in the template tags for that field.
hmp
Posts: 146
Joined: Fri Dec 14, 2007 3:00 am

Re: Math action bug

Post by hmp »

Ok thanks, I changed the template file and made it into an addon so it is fixed by default, changing it manually seems to work too, although I could swear I tried that before without success.
Post Reply