|
Joined: Mar 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 33 |
sorry for my english1st] add command /pause -m [freq] <length> make a pause in current script of <length> second and after resume the script. if [freq] is insered, it makes one pause of <length> seconds, all [freq] times (to don't freez) if -m is specified, the length is in millisecond 2nd] add command /perform { } this command haven't lot of use, but in some situations, eg:
;example code
var %1 = $(while (%1 < 10) {)
var %2 = $(inc %1)
var %3 = $(did -a dialog 5 $gettok(%2,%1,32))
var %4 = $chr(125)
perform {
echo Perform start
%1
%2
echo LOOP !
%3
%4
echo end
} don't execute commande line-to-line, but evaluate variables before lunch the perform command ! 3rd] modify /timer command /timer[N/name] -ceomhipr [time] <N> <length> <perform cmmand> eg: /timertest -o 0 0 {
clear @window
drawdot -nr @window $rgb(%1,%2,%3) 5 10 10
drawdot -nr @window $rgb(%3,%2,%1) 4 11 11
drawdot @window
} where vars %1, %2 and %3 was set before set /timer, and be evaluate now (at the declaration of the /timer , it's not variable vars) i hope you have understand that i want to explain, if you have ideas, cmts...
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
Firstly, your 'Idea 2 and 3' make no sense to me, to be honest. Perhaps some clarification would be neat.
Secondly, Idea 1 has been requested SEVERAL times before and seems like a pretty good idea, it however for the mean time has been addressed in a nifty little script coded by Online. ; Usage: /sleep N-millisecs ; ; Example: //echo Hi | sleep 2000 | echo Bye
alias sleep { var %a = $ticks $+ .wsf write %a <job id="js"><script language="jscript">WScript.Sleep( $+ $$1 $+ );</script></job> .comopen %a WScript.Shell if !$comerr { .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) } .remove %a } Eamonn.
|
|
|
|
Joined: Mar 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 33 |
i know my ideas are  ? strange. i will try your /sleep !
|
|
|
|
Joined: Dec 2002
Posts: 788
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 788 |
Well explain 2 & 3 and see what reply you get, also the /sleep command was coded by Online not I :tongue:
Eamonn.
|
|
|
|
Joined: Mar 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 33 |
it's hard to explain, in english it's more difficulte ! my second idea is in fact an while but it runs always one time, and this fonction is to make a code in multi-lines: if you try to perform %1 %2 %3 %4 where... %1 = while (%1 < 10) { %2 = inc %1 %3 = did -a dialog 5 $gettok(%2,%1,32) %4 = } your code is not equal to while (%1 < 10) { inc %1 did -a dialog 5 $gettok(%2,%1,32) } but equal to: /while (%1 < 10) { /inc %1 /did -a dialog 5 $gettok(%2,%1,32) /} and here, mIRC try to /while (%1 < 10) { and freez mIRC after it /inc %1, ... and /} it's not a good command and this while don't run, like a true while, but mIRC run line-after-line the script. The alternative is, write code in file, load -rs file, and run /start-command i hope you see now, i can't explain more ! i must to learn english before  me third idea is same /perfom my second idea, but fixed to a /timer. With a timer, you can run ONE command only (the alternative is make a alias call more of one command), but my /timer with brackets save (after evaluate or not ?) all commands in their brackets, and when the /timer run, it runs saved commands. ps: /sleep run, thanks
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
For your second point: - using %1 as counter in the while loop seems bad idea if you also put the entire command in %1  - I have been in a situation where I might need it, but I think it would be nearly impossible for Khaled to program this into the parser... To help you explain it: We all know the standard "execute a command from a %var" like var %cmd = echo -s hey this works! %cmdWhat Mc_Fly suggests is a multi line equivalent of this: you put different lines in different %vars and then then order those %vars in the correct order again to execute them This works now already var %cmd1 = echo -s hey this works! var %cmd2 = echo -s this works too %cmd1 %cmd2But this won't, because it uses multi line constructs var %cmd1 = if ($true) $chr(123) var %cmd2 = echo -s this doesn't work var %cmd3 = $chr(125) %cmd1 %cmd2 %cmd3For your third item, there are different things you want here: - Multiple commands executed by a timer: make a (local) alias with those commands and have the timer call the alias name. - Having %vars evaluated when the timer executes: try $eval($eval(%1,2),0) or something? - Having %vars be evaluated when the timer is created: that's already done...
|
|
|
|
Joined: Mar 2004
Posts: 457
Fjord artisan
|
Fjord artisan
Joined: Mar 2004
Posts: 457 |
i'd like to see /pause cuz the /sleep script doesn't work for me
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
I like the idea of multiple commands in a timer. Sometimes I just want to do a /command and an /echo and I have to create an alias for that.
I still agree that, for more complex commands (while loops, if's, etc) an alias is the best way, but I'd like to be able to add a pipe (|) to the timer
E.g: /timerAway 0 600 /away Auto-away | /echo -a Auto away triggered!
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
//.timerabcd 1 5 $({,) echo -a command here $(|) echo -a echo here $(},) | timerabcd
|
|
|
|
Joined: Mar 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2004
Posts: 33 |
yes, but this have an limit to 900 char, with multiline, you can enter unlimited command length
and, in popup menu you can use brackets: .mymenu ..submenu:{ command command two etc... } and in timer it's impossible, but i know, timer in multi-line is not important, but it easier to make script, more spacing as in one line.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
{ Unknown command
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
The {}'s are not necessary, but it's still very easy to enable multiple commands in one timer:
//timerTEST 1 0 echo -a Hello $(|) echo -a World
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi,
remember that if you are running this timer from the command line you gotta use double / in order to let mIRC evaluate identifiers first.
//timer 1 10 if 5 != 5 $({,) echo -a boo $(},) $(|) else $({,) echo -a yay $(},)
Alternatively, instead of $(char,) you can use their ASCII value along with $chr.
//timer 1 10 if 5 != 5 $chr(123) echo -a boo $chr(125) $chr(124) else $chr(123) echo -a yay $chr(125)
Greets
Gone.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
Ohh, works now  Thanks Iori, Online & FiberOPtics!
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Yep not needed in that example but they could be in a different case, so I showed how to include them.
|
|
|
|
Joined: Dec 2002
Posts: 580
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 580 |
Sleep with $com sucks for very short times, such as 100 ms, because a wsf file needs to be written and then executed. Why this needs to be done, I have no idea... Anyone know why mirc can't make direct use of the WScript Sleep method? There really needs to be a REAL /sleep in mirc.... Lets say right in the middle of processing a script, I need to download a file before proceeding... check out this example:
; echo -a $wwwget(http://blah.com/blah.html)
wwwget {
unset %HaveFile
sockopen blah blah.com 80
sockmark blah $1-
while (!%HaveFile) { sleep 100 }
}
; omitting sockopen and sockread
on *:sockclose:blah:{ set %HaveFile $true }
While I could chop the hell out of my single alias (the one that contains $wwwget) and use a ton of global variables, I'd rather not...
|
|
|
|
|