Advertisement
Sphyrwa

Score to time converter for MGS2 VR missions

Sep 14th, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.69 KB | None | 0 0
  1. on *:TEXT:!SCORE*:*:{
  2.   if ($2 isnum) {
  3.     if (($2 < 1000000) && ($2 > 0)) {
  4.       var %score $2
  5.       ;Stores the score for the final output
  6.       ;I will provide examples in comments using score 234982 as an example
  7.       var %x $int($2)
  8.       ;Turns score into a whole integer in case someone is a douche and enters something stupid like 1234,56
  9.       var %x $calc(%x / 1000)
  10.       ;Turns score into seconds
  11.       ;Variable x is now 234.982 in seconds.
  12.       var %x $calc(1000 - %x)
  13.       ;The time is now "flipped"
  14.       ;Variable x is now 765.018 in seconds
  15.       var %x $calc(%x / 60)
  16.       ;Turns seconds into minutes
  17.       ;Variable x is now 12.7503 in minutes
  18.       /tokenize 46 %x
  19.       ;Separates the number using the period (chr 46) as a separator
  20.       ;Variable x was separated into 12 and 7503
  21.       var %x $1
  22.       ;Variable x is now whole minutes
  23.       var %y $+(0,$chr(46),$2)
  24.       ;Creating a variable y, which is the rest of the minutes. Appending 0. in front of the 7503
  25.       ;Variable y is now 0.7503
  26.       var %z $calc(%y * 60)
  27.       ;Turns the percent of minutes into seconds left
  28.       ;Variable z is now 45.018
  29.       /tokenize 46 %z
  30.       var %y $1
  31.       ;Variable y is now just 45 seconds
  32.       var %z $2
  33.       ;Creating a variable z for milliseconds
  34.       ;Variable z is now 018 milliseconds
  35.       var %z $left(%z,3)
  36.       ;Formats the milliseconds so its always three numbers long
  37.       ;x is now minutes, y is now seconds, z is now milliseconds
  38.       /msg $chan Score %score equals to $+(%x,m) $+(%y,s) $+(%z,ms)
  39.     }
  40.     else {
  41.       /msg $chan Score has to be between 1 - 999999!
  42.     }
  43.   }
  44.   else {
  45.     /msg $chan Score has to be a number!
  46.   }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement