#Rounding issue with number 8.29

1 messages · Page 1 of 1 (latest)

brittle marsh
#

use lists and uuids

#

{var::%player's uuid%}

#

vastly superior

#

its because youre using a local var, which will only last for one click

#

you should just set the cooldown variable to now

fading lotus
#
    if "%lore of player's held item%" contains "Dragon Blast":
        if player can build at player's location:
            set {_WANDDURATION3} to line 2 of lore of player's held item
            set {_WAND3::*} to {_WANDDURATION3} split at ": "
            set {MATH3} to {_WAND3::2} parsed as number
            set {WORD3} to {_WAND3::1}
            set {_waited} to difference between {cooldown.dragon.%player's uuid%} and now
            broadcast "%{_waited}%"
            if {_waited} is less than 8 seconds:
                send "&cThis item needs %difference between 8 seconds and {_waited}% to cooldown." to player
                stop
            set line 2 of lore of player's held item to "%{WORD3}%: %{MATH3}-1%"
            set {cooldown.dragon.%player's uuid%} to true 
            play sound "minecraft:entity.ender_dragon.shoot" with volume 2 with pitch 0.8 at player
            shoot dragon fireball from player at speed 0.35
            set {cooldown.dragon.%player's uuid%} to now 
            if player cannot build at player's location:
                send "&cYou don't have permission to use this here." to player```
#

Ok this works, how do I make
send "&cThis item needs %difference between 8 seconds and {_waited}% to cooldown." to player
display as an interger tho so numbers such as 6.92 don't appear

#

(it has uuid now)

fading lotus
#

I tried setting a number to a rounded version of itself with set {variable} to round{variable} and it just turns it into <none>

#

Rounding issue with number 8.29

#
                set {_roundedwaited} to rounded difference between 8 seconds and {_waited}
                send "&cThis item needs %{_roundedwaited}% to cooldown." to player
                stop```

This also doesn't work, not sure how to round things without it erroring
#
                set {_roundedwaited} to round({_waited2})
                send "&cThis item needs %{_roundedwaited}% to cooldown." to player
                stop```
This doesn't error but it sends out <none>
#

@tribal rapids

brittle marsh
#

bruh literally just the round function

fading lotus
#

?

#

i tried like 12 dif things

#
``` doesn't work either (can't understand condition/event)
#

Fiend is a master coder.

brittle marsh
#

round(number) returns the closest integer

vestal egret
#

Fr

brittle marsh
#

floor removes all decimals

fading lotus
#

yeah

#

i know what those mean but they either error or return <none>

#
                set {_waited2} to floor(%difference between 8 seconds and {_waited}%)
                send "&cThis item needs %{_waited2}% to cooldown." to player
                stop```

Tried this, error
brittle marsh
#

yes

#

because a timespan is not a number

fading lotus
#

I probly have to parse this or something X_x