mIRC Homepage
Posted By: FaveN 2 Questions about scripts - 25/10/14 04:04 PM
Hello everyone,

iam pretty new to mIRC and havn't got that for in scripts with mIRC. My first question is:

Can i copy a part of a text from a other person and then "paste" it in my command?

Example:
Code:
Stranger: Your have 350 tokens.

Copy the tokens and set it as a variable.
on *:TEXT:Your have X tokens.:#:{
  ; variable X = 350 from above.
  timer 1 5 msg $chan !raffle X ; = 350
}


Is there any way todo that?

2. Question:

If that with the variable is possible can i check for variable is higher then a certian number like:

Code:
Stranger: Your have 350 tokens.

If X = >5 //insert in 
If X = <5 //dont insert and ignore the rest of script

on *:TEXT:Your have X tokens.:#:{
  ; variable X = 350 from above.
  timer 1 5 msg $chan !raffle X ; = 350
}


Thanks,
FaveN




Posted By: Nillen Re: 2 Questions about scripts - 25/10/14 08:53 PM
Code:
on *:text:Your have & tokens:#: {
var %x $3
if (%x <= 5) return
timer 1 5 msg # !raffle %x
}

Note; $3 is the third word written, thus making a variable out of the third word you use "var %name $3" - If you plan on using this for timers, you can lose control of your pc. I recommend using the $safe alias to prevent this from happening.
Code:
alias safe return $!decode( $encode($1,m) ,m)

In your case, you're fine since you're only looking for a number. If the value of %x is under 5, which anything that has text in it will be you'll simply not to it. But for future stuff where you can use text in your variables, you should use "timer 1 5 msg # Assuming %x has text: $safe(%x)" for instance.
Posted By: FaveN Re: 2 Questions about scripts - 25/10/14 10:37 PM
Thanks for all informations.

Now my Question is how can i pass a varible that changes hour time. Can i just use a "*" to pass it or is there something special i have to insert?
Code:
BOT: myname [x Hrs] - & , other guy stats
// x = a variable that will change every hour i stay in the channel
// & = is the variable that i want to get


I still want to insert that in the code ou wrote me but just like that:

Code:
on *:text:*myname [x Hrs] - &*:#: {
  var %x $3
  if (%x <= 5) return
  timer 2 3 msg # !raffle %x
}


I probable have to change the "$3" to "$5" dont i.
© mIRC Discussion Forums