mIRC Homepage
Posted By: westor Variable help. - 13/04/12 11:26 AM
Hello,

I have this alias for deleting the variable and does not working.

e.g: /delallmybets

%bet_mynick_total 2
%bet_mynick_1 ....
%bet_mynick_2 ....

Code:
alias delallmybets {
  if (!%bet_ [ $+ [ $nick ] $+ ] _total) { .msg $nick [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
  var %t = %bet_ [ $+ [ $nick ] $+ ] _total
  var %i = 1
  while (%i <= %t) {
    unset %bet_ [ $+ [ $nick ] $+ ] _ $+ %i
    if (%i == %t) { .msg $nick [ $+ $nick $+ ]: All of your BET(s) has been deleted. TOTAL: 10 $+ %t $+  - 3SUCCESSFULLY | return }
    inc %i
  }
  inc %i
}
Posted By: sparta Re: Variable help. - 13/04/12 11:42 AM
/unset bet_*
Posted By: westor Re: Variable help. - 13/04/12 11:48 AM
Yes that helped, thanks!

Now i have an other issue when i wanna see my bets.

Code:
alias listmybets {
  if (!%bet_ [ $+ [ $nick ] $+ ] _total) { .msg $nick [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
  var %t = %bet_ [ $+ [ $nick ] $+ ] _total
  var %i = 1
  while (%i <= %t) {
    var %v = %bet_ [ $+ $nick $+ ] _ $+ %i
    .msg $nick [ $+ $nick $+ ]: NUMBER # $+ %i - %v
    if (%i == %t) { .msg $nick [ $+ $nick $+ ]: List BET(s) has been finished. - TOTAL: 10 $+ %t $+  - 3SUCCESSFULLY }
    inc %i
  }
  inc %i
}
Posted By: Riamus2 Re: Variable help. - 13/04/12 04:27 PM
Change:
Code:
%bet_ [ $+ [ $nick ] $+ ] _total

To:
Code:
$($+(%,bet_,$nick,_total),2)


If you really want to mess around with []'s, you can change it to:
Code:
%bet_ [ $+ [ $nick ] $+ [ _total ] ]


I didn't look closely, so there may be other issues, but there's the first problem I noticed.
© mIRC Discussion Forums