I'm trying to make a small chrono script displaying in action bar but I can't format the text as I would like
It works by calculating the difference between "now" and a previous value of "now" stored in a variable, but the result of this difference seems to be stored in a text variable, therefore I can't format it as "MM:SS"
Here is the script :
It works by calculating the difference between "now" and a previous value of "now" stored in a variable, but the result of this difference seems to be stored in a text variable, therefore I can't format it as "MM:SS"
Here is the script :
JavaScript:
function CountDisplay(p: player):
set {_minutes} to "00"
while {boatRacing::%{_p}'s uuid%} is true: #while the player is racing
set {_time} to difference between {boatTimer::%{_p}'s uuid%} and now #{boatTimer::%{_p}'s uuid%} stores a previous value of now
set {_timeDate} to {_time} parsed as date #I try to force parsing time as a date type but I receive an error telling me I can't parse text as date
set {_seconds} to {_timedate} formatted as "ss" #This variable is never attributed, that's why I think I need a date or time type for "formatted as" to work
send {_seconds} to {_p}
set {_minutes} to {_timedate} formatted as "mm" #same here
send action bar "%{_minutes}%:%{_seconds}%" to {_p} #the action bar says "<none>:<none>"
wait 1 seconds