Float var display

Hello, this is my first question.

I don’t know this question is proper this topic well.
I ask to be excused.

I hope to display 체력 like 94% type of int.
but i can’t change the var. Is it support change type of var??

i made like this
*set healthPer (healthCur/healthMax)*100

Thank you
kihyun

You can round down the number using
*round 체력

The decimals will be “cut off” and you will have a clean, double digits HP

TBH, I’m not quite familiar with Korean writings. So, forgive me if I mistaken something :sweat_smile:

I tried to var. but it is error message output like this
"battle line 9: Invalid expression at char 1, expected NUMBER, STRING, VAR or PARENTHETICAL, was: OPERATOR [
]"

this is my code
//-------------
{count} 합 "{name} vs ${EnumyName}"
*stat_chart
text name ::
percent *healthPer 체력

*stat_chart
text EnumyName ::
percent *EnumyhealthPer 체력
//-------------

healthPer is (healthCur/healthMax)*100

I’m not also familiar with English ^^;; very Thank you for help

Hmm, I see.
Try use this code instead

제 {count} 합 "{name} vs ${EnumyName}"

*stat_chart
   text name ::
   percent healthPer 체력
   text EnumyName ::
   percent *EnumyhealthPer 체력

Just change the :point_up_2:t4: indentation and adjust it to match your actual code indentation.


BTW, you can use the </> button to “codify” your text.

1 Like

I put the indentation. and if i try to change to *EnumyhealthPer, error message still come out

I attached the code screen shot

Hmmm… that’s weird :thinking:

I’m not sure if this is the cause, but you have a “double space” on line 13
opposed_pair allyForce
Try fix that.


BTW, what kind of error message are you getting for this time?

it is very strange.

fix the double space… but problem is still. The script can’t support type of var change.

Very Thanksful:::grinning:

@Khkim, off-topic but it’s great to see a Korean writer here!

For your problem, what is the default input for the variable?

If you want it to change from a Boolean to a number, instead of starting with the Boolean, start with 0 or 1 (for false true).

If you want it to change from text to a number, it’s probably easier to add an extra variable rather than try to change it.

If you just wish to change the value of the variable, try doing so before the stat_chart. Again, either use a new variable or remember to reverse the variable after the stat_chart.

Oh, I see your problem! Maybe… :grimacing:

Can I see the code of startup.txt?
Maybe there’s a little mistake on the list of the *create commands.

Thanksfully!

I try to upload the .txt file. but this place is not support txt file (only jpg, png …)

so I remaind the var information.
in startup.txt
*create healthMax 100
*create healthCur 100
*create healthPer 0

in battle.txt
*set healthCur healthMax
*set healthPer (healthCur/healthMax)*100

and finally i displayed healthPer
*stat_chart
text name ::
percent healthPer 체력
text EnumyName ::
percent EnumyhealthPer 체력

This code displayed health percentage in web
and i tried one thing
make the one var *create healthDummy 0 and before *stat_chart i input the healthPer in healthDummy
i think it is changed type of var. but nothing changed.

thanks

Oh, I’ve just re-read your question from the first post, and saw this


So, basically, you want to display the 94% as text, isn’t it? (In which case, Korean text I assume?)

If that is the case, I’m afraid the question is: Yes, changing type of variable is impossible. :frowning_face:

Ah…I see
VeryVery Thank you Szaal. I’ll have to do something else first.( I believe this problem will improve)

1 Like