Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:TEXT:!SCORE*:*:{
- if ($2 isnum) {
- if (($2 < 1000000) && ($2 > 0)) {
- var %score $2
- ;Stores the score for the final output
- ;I will provide examples in comments using score 234982 as an example
- var %x $int($2)
- ;Turns score into a whole integer in case someone is a douche and enters something stupid like 1234,56
- var %x $calc(%x / 1000)
- ;Turns score into seconds
- ;Variable x is now 234.982 in seconds.
- var %x $calc(1000 - %x)
- ;The time is now "flipped"
- ;Variable x is now 765.018 in seconds
- var %x $calc(%x / 60)
- ;Turns seconds into minutes
- ;Variable x is now 12.7503 in minutes
- /tokenize 46 %x
- ;Separates the number using the period (chr 46) as a separator
- ;Variable x was separated into 12 and 7503
- var %x $1
- ;Variable x is now whole minutes
- var %y $+(0,$chr(46),$2)
- ;Creating a variable y, which is the rest of the minutes. Appending 0. in front of the 7503
- ;Variable y is now 0.7503
- var %z $calc(%y * 60)
- ;Turns the percent of minutes into seconds left
- ;Variable z is now 45.018
- /tokenize 46 %z
- var %y $1
- ;Variable y is now just 45 seconds
- var %z $2
- ;Creating a variable z for milliseconds
- ;Variable z is now 018 milliseconds
- var %z $left(%z,3)
- ;Formats the milliseconds so its always three numbers long
- ;x is now minutes, y is now seconds, z is now milliseconds
- /msg $chan Score %score equals to $+(%x,m) $+(%y,s) $+(%z,ms)
- }
- else {
- /msg $chan Score has to be between 1 - 999999!
- }
- }
- else {
- /msg $chan Score has to be a number!
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement