mIRC Home    About    Download    Register    News    Help

Print Thread
on *:REACH: or on *:SET: #64027 14/12/03 09:28 AM
Joined: Oct 2003
Posts: 18
I
Insanatic Offline OP
Pikka bird
OP Offline
Pikka bird
I
Joined: Oct 2003
Posts: 18
I posted something about this before and i guess i didnt think it through enough, but now it hink i may hav:

Once a %variable reaches a certain number it would perform specified commands.
Example:
on *:SET:%counter.msgs:1000:/set %counter.msgs 0
This would meen once the variable %counter.msgs reaches 1000 it would reset it self.

Hope that does make sense,
Thanks always,
Baden

Re: on *:REACH: or on *:SET: #64028 14/12/03 10:23 AM
Joined: Jun 2003
Posts: 195
N
Narusegawa_Naru Offline
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
actually i like this idea. but not for a reset. perhaps a switch denoting the maximum value increation such as

/var -m5 %blah = 4

/inc %blah

now its 4 because it reached 5 wich was the max and reset to 4.


Have Fun smile
Re: on *:REACH: or on *:SET: #64029 14/12/03 02:26 PM
Joined: Sep 2003
Posts: 70
M
madewokherd Offline
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
Wouldn't it be easier to make an alias to inc the variable and check whether or not it is at that point? It seems to me that having an event like this would greatly slow down the processing of scripts.

Re: on *:REACH: or on *:SET: #64030 14/12/03 08:59 PM
Joined: Nov 2003
Posts: 228
S
Seifer Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Nov 2003
Posts: 228
I think it's the opposite way around, an alias would be much slower than if it were an internal function.

Re: on *:REACH: or on *:SET: #64031 14/12/03 09:31 PM
Joined: Sep 2003
Posts: 70
M
madewokherd Offline
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
In the one case you're talking about, yes, it would be faster.

But every other time you set a variable, it would be slower.

Re: on *:REACH: or on *:SET: #64032 14/12/03 09:56 PM
Joined: Dec 2002
Posts: 155
S
Strider Offline
Vogon poet
Offline
Vogon poet
S
Joined: Dec 2002
Posts: 155
I agree with you. There's no need for an event or an option here, since you are the one who increments the value of the variable with an alias or with an event.

The best way of doing this is by adding the condition to the event or alias where the variable is changed.

Re: on *:REACH: or on *:SET: #64033 15/12/03 12:55 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
BTW, with your comment about "only one to increment it", check out /inc and /dec's -c switch.


-KingTomato
Re: on *:REACH: or on *:SET: #64034 15/12/03 08:16 AM
Joined: Jan 2003
Posts: 154
B
BoredNL Offline
Vogon poet
Offline
Vogon poet
B
Joined: Jan 2003
Posts: 154
you can just create some basic script to do this whenever you need this. The script would be slower than if it was implimented internally, but I have to agree with madewokherd that it would definately hinder over all performance and all for a very specific circumstance.

Here's an example script for you:

Code:
alias wee { 
  echo -a And here we go..  (10 is the limit as set in the alias sdi, and 1 is the default number)
  set2 wee 1
  echo -a Set it as: %wee
  inc2 wee 6
  echo -a Added 6: %wee
  dec2 wee 3
  echo -a Subtracted 3: %wee
  inc2 wee 50
  echo -a Incremented it 40 past it's limit: %wee
  unset %wee
  echo All done!
}
alias set2 {
  set % $+ [ $1- ]
  sdi $1
  }
alias inc2 { 
 inc % $+ [ $1- ]
  sdi $1
}
alias dec2 { 
 dec % $+ [ $1- ]
  sdi $1
}
alias -l sdi { if ( [ % $+ [ $1 ] ] >= 10) {  set  % $+ [ $1 ] 1 } }


If you have the number decreasing every second or incrementing every second or something, then I suggest to you to create a more complex script that will have a timer running evert second, which will run an alias which will look through a list of variable names which would be stored in a hash file to check all the variables every second, removing variables that stop decreasing or incrementing, untill the hash file is empty, then the timer would be unset.

I think Narusegawa_Naru's suggestion is a much better suggestion, but still not a very important one.


- Wherever you go there you are.[color:lightgreen]
Re: on *:REACH: or on *:SET: #64035 15/12/03 09:43 AM
Joined: Oct 2003
Posts: 18
I
Insanatic Offline OP
Pikka bird
OP Offline
Pikka bird
I
Joined: Oct 2003
Posts: 18
But how would that make it quicker? it has to go through like 15 lines to do only a few things.

BTW, i only used the reset as an example. I think it would
a) be easier for scripters
b) quicker
Oh well its only my opinion,
Thanks as always
Baden

Re: on *:REACH: or on *:SET: #64036 15/12/03 10:07 AM
Joined: Dec 2002
Posts: 155
S
Strider Offline
Vogon poet
Offline
Vogon poet
S
Joined: Dec 2002
Posts: 155
So?

If you want to perform a command after certain time has passed, it's best that you use a timer, and not an incremental variable.

Re: on *:REACH: or on *:SET: #64037 15/12/03 06:17 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I'm not here to get in an argument, but its not correct to assume "the user is the only one making the increment". Making timers is again slow, and tedious. All I was suggesting is that there are alternative increments. I mean just because in script 1 you use /inc -c doesn't mean in script 2 you can't sue a /dec.


-KingTomato
Re: on *:REACH: or on *:SET: #64038 16/12/03 06:14 AM
Joined: Dec 2002
Posts: 155
S
Strider Offline
Vogon poet
Offline
Vogon poet
S
Joined: Dec 2002
Posts: 155
Read my original post and notice how I did not use the word "only".

Re: on *:REACH: or on *:SET: #64039 16/12/03 06:32 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
'the one', means only in my book. Its like saying they are 'the one' with the password, only they have the password.


-KingTomato