mIRC Home    About    Download    Register    News    Help

Print Thread
Variables #243559 27/11/13 08:42 PM
Joined: Nov 2013
Posts: 21
A
AlphaKennyHuan Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Nov 2013
Posts: 21
Hey guys, i have set up a giveaway system for my channel where it picks a random user and they win using this:

Code:
on *:text:!giveaway:#:{
  if ($nick isop #) {
  msg # $upper($nick(#,$rand(1,$nick(#,0)))) Just won the giveaway, we'll send you a message with details on how to obtain. }
  else { msg # Dear $nick , You do not have permission to use this command! }
}


I was wondering if there was a way to get the name that it randomly picks, as i have a points system set up and what it to display the amount of points that the winner has

This is the coding that i would normally use to make it read a number of points that the user has:

Code:
$readini(Points.ini,$+(#,.,$nick),Points)



How would i make it so that when the bot picks a random user, that i can put it into the $readini coding instaed of where the $nick lies, so it would say:

BLAHBLAH ( Has 124 Points) Just won the giveaway, we'll send you a message with details on how to obtain.

Last edited by AlphaKennyHuan; 27/11/13 08:43 PM.
Re: Variables [Re: AlphaKennyHuan] #243560 27/11/13 09:23 PM
Joined: Jul 2006
Posts: 3,703
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,703
Looks like you knew the title of your post is the answer: use a variable:

Code:
on *:text:!giveaway:#:{
  if ($nick isop #) {
   var %randnick $nick(#,$rand(1,$nick(#,0)))
   msg # $upper(%randnick) ( $+ $readini(points.ini,n,$+(#,%randnick),points) $+ ) Just won the giveaway, we'll send you a message with details on how to obtain.
  }
  else { 
msg # Dear $nick , You do not have permission to use this command!
 }
}


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Variables [Re: Wims] #243573 28/11/13 10:53 PM
Joined: Nov 2013
Posts: 21
A
AlphaKennyHuan Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Nov 2013
Posts: 21
thank you, i am face palming so hard right now