mIRC Home    About    Download    Register    News    Help

Print Thread
#59552 08/11/03 09:05 PM
Joined: Jul 2003
Posts: 4
S
shinji Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2003
Posts: 4
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
Joined: Oct 2003
Posts: 51
Z
zfr Offline
Babel fish
Offline
Babel fish
Z
Joined: Oct 2003
Posts: 51
like this:

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

#59554 08/11/03 09:47 PM
Joined: Jul 2003
Posts: 4
S
shinji Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2003
Posts: 4
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
Joined: Oct 2003
Posts: 51
Z
zfr Offline
Babel fish
Offline
Babel fish
Z
Joined: Oct 2003
Posts: 51
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
Joined: Nov 2003
Posts: 6
Q
Qw_ Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Q
Joined: Nov 2003
Posts: 6
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"


while ( 0 = 0 ) { echo 4 IRC is cancer for You! Type /exit !!! }
#59557 09/11/03 01:13 PM
Joined: Jul 2003
Posts: 4
S
shinji Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2003
Posts: 4
(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,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#59559 12/11/03 05:16 PM
Joined: Nov 2003
Posts: 6
Q
Qw_ Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Q
Joined: Nov 2003
Posts: 6
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!


while ( 0 = 0 ) { echo 4 IRC is cancer for You! Type /exit !!! }

Link Copied to Clipboard