Random Number

By Johncena1469 on Aug 12, 2009

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~

Comments

Sign in to comment.
tra_orex   -  Aug 17, 2009

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 ;)

 Respond  
Johncena1469   -  Aug 13, 2009

For one : This has security from spammers.
For two : If you want a short snappy, non protective, uncolorful script, go elsewhere
For three : All my scripts have alot of color in them. | So its bound to be long |

 Respond  
Master-Of-Death   -  Aug 13, 2009

What's the point in a longer spammy version?, wasn't the point of $rand to lower the amount of code used?

8/10 for effort
3/10 for praticality

 Respond  
PuNkTuReD   -  Aug 13, 2009

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• 
}
 Respond  
Johncena1469   -  Aug 12, 2009

Indeed.

 Respond  
HeatedHeart   -  Aug 12, 2009
 on *:text:*!RandNumber *:*:{ msg $active $rand(1,$2) } 

so basicaly That in a longer, spammy, version? :P

 Respond  
Johncena1469   -  Aug 12, 2009

Yeah technecly.

 Respond  
Scakk   -  Aug 12, 2009

$rand(1,othernumber)

 Respond  
Johncena1469   -  Aug 12, 2009

In a channel type !randnumber and itl send back a number between 1 and the number you posted.

 Respond  
Master-Of-Death   -  Aug 12, 2009

what's it do

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.