mIRC Home    About    Download    Register    News    Help

Print Thread
#59552 08/11/03 09:05 PM
S
shinji
shinji
S
Hi,

i just try to make a script like a user-warning-system

i need to know how i can set a variable like %$nick-war1
example: % is like in mirc :P the beginning of the variable name
$nick is the nickname as example 'jonny' the -war1 is for the specification

it should look like this:
%jonny-war1

is this possible or can u tell me another way how to do it like that?

thx for your time

#59553 08/11/03 09:15 PM
Z
zfr
zfr
Z
like this:

set % $+ $nick $+ -war1 = ...

#59554 08/11/03 09:47 PM
S
shinji
shinji
S
can u help me with that too?

Code:
menu nicklist {
  -
  Warning
  .Spam:{
    inc % $+ $1 $+ -war-spam
    if (% $+ $1 $+ -war-spam != 3) { /msg $chan 4 $1 this is warning nr. % $+ $1 $+ -war-spam cause SPAM
    }
    { /set % $+ $1 $+ -war-spam 0
      /msg $chan 4 $+ $1 $+  this was the third warning cause SPAM ---- have fun been banned
      /ban -k $chan $1 3
    }
  }
}


after i clicked the menĂ¼ the mirc does that:

Quote:
(22:47:06) (@shinji) OverLord this is warning nr. %OverLord-war-spam cause SPAM
(22:47:06) (@shinji) OverLord this was the third warning cause SPAM ---- have fun been banned

the one i clicked was OverLord

#59555 08/11/03 10:32 PM
Z
zfr
zfr
Z
try this, but i'm not sure because i haven't tested it:

Code:
-
Warning
  .Spam:{
    var %num = % $+ $1 $+ -war-spam
    inc %num
    if (%num < 3) { .msg $chan 4 $1 this is warning nr. %num  cause SPAM }
    else {
    unset % $+ $1 $+ -war-spam
    .msg $chan 4 $+ $1 $+  this was the third warning cause SPAM ---- have fun been banned
    ban -k $chan $1 3
  }
}


#59556 09/11/03 11:58 AM
Q
Qw_
Qw_
Q
You see, it won't work.
set % $+ $nick $+ -war1 = ...
Cause $nick is evaluated AFTER anything else. It looks like:
set % zfr-war1 = ...
And You get a "zfr-war1 = ..." in variable "%".
You nedd doing like this:
set % [ $+ [ $nick ] $+ -war1 ] ...
Brackets show, that $nick, $+, $+, -war1 need to be evaluated first, and You get "..." in variable "%zfr-war1"

#59557 09/11/03 01:13 PM
S
shinji
shinji
S
(14:37:09) (@shinji) OverLord this is warning nr. %OverLord-war-spam cause SPAM

Last edited by shinji; 09/11/03 01:37 PM.
#59558 09/11/03 01:29 PM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Wrong. I'd advise you to test things and make sure they (don't) work before you try to help others. Try this:
Code:
//set % $+ $me $+ -test blah | echo -a % [ $+ [ $me ] $+ -test ]
shinji: you can get an idea on how dynamic variables work from the above example. This forum has tons of posts about dynamic variables, use the Search feature to find them. For example, this, which demonstrates the $eval() - or the equivalent $() - way of retrieving the value of dynamic variables. My example above uses evaluation brackets instead. Both work.

#59559 12/11/03 05:16 PM
Q
Qw_
Qw_
Q
Yep...
You're quite right. My mistake.

But You see, it's not an problem, because it's not causing script to fail. It's just, maybe, harder to understand. But it's right!


Link Copied to Clipboard