How to use : !RandNumber [Number]
Make sure you /set %chanset #[Channel]
;Made by Dusk/Nido/Jc
;Read intro for usage
;Enjoy.
on *:text:*!RandNumber *:*:{
if ($chan != %ChanSet) { halt }
if (/ isin $2-) { halt }
if ($ isin $2-) { halt }
if (Yes == %generating) { halt }
randnumber $1-
set %generating Yes
}
alias randnumber {
set %randnumber $2-
.msg $chan 15,18•7•8•7•15,1(4Generating...15)7,1•8•7•8•
.timerrand 1 5 msg $chan 15,18•7•8•7•15,1(4Random Number from 1 to $2- =9 $r(1,%randnumber) 15)7,1•8•7•8•
.timer 1 5 set %Generating No
}
;Please give credits~
i would have used $rand then used a while to parse the digits and add your colors(would be a lot more colorful)
in the end, you really just used $rand to make your random number. I kinda expected u had actually wrote a random number algorithm or used a socket to pull a "true" random number from a site.
Other than its usefulness, good job, keep it up, and get working on that algo ;)
on :text:!RandNumber :#: $iif($2 isnum,say $r(1,$2),say please specify a number.)
on a serious note tho, you should use return instead of halt.
also using $2 isnum will be better then $ isin $2 etc.
;you can put your var here so itll only trigger in the one channel.
on *:text:!RandNumber *:%ChanSet:{
;check if generating does not exist, and check if $2 isnum.
$iif((!%generating) && ($2 isnum),,randnumber $2-)
}
alias randnumber {
;set %generating true for 5 seconds.
set -u5 %generating $true
;set %randnumber the number the person spefified, dont use $$1- because it will cause problems if they type !randnumber 1 2 3 4.
set -u5 %randnumber $$1
;first channel message.
.msg $chan 15,18•7•8•7•15,1(4Generating...15)7,1•8•7•8•
;second channel message.
.timerrand 1 5 msg $chan 15,18•7•8•7•15,1(4Random Number from 1 to %randnumber =9 $r(1,%randnumber) 15)7,1•8•7•8•
}