View Full Version : Pausing a script
Okay this may sound really retarded, but I'm wondering if you can assign a hotkey to the Pause function of a script in Simba...
Theres CTRL+ALT+R for run and CTRL+ALT+S for stop, but there's no pause hotkey.
I tried creating it myself with a small procedure below:
Procedure PauseIt;
begin
if IsKeyDown(127) // that's DEL on your keyboard
then begin
A command that will tell the script to shut down goes here
end else
wait(10);
end;
So... What function or procedure do I call to make it pause my script?
Footy
08-13-2012, 01:40 PM
Im asuming this is for scripts not using smart. You can make a procedure like this
Procedure Terminate;
begin
if iskeydown(Yourkeyofchoice) then
Terminatescript;
end;
Now just sprinkle this procedure throughout your script, and if the procedure is run and the key is down, it should kill the script.
end;
Im asuming this is for scripts not using smart. You can make a procedure like this
Procedure Terminate;
begin
if iskeydown(Yourkeyofchoice) then
Terminatescript;
end;
Now just sprinkle this procedure throughout your script, and if the procedure is run and the key is down, it should kill the script.
end;
he want to pause it not terminate it, terminate=stop.
To OP: you will probably have to compile and edit the simba source which will be very complicated so perhaps just suggest that to wizzup?
If you like IsKeyDown so much, you can also try:
procedure Pause;
begin
if IsKeyDown(assign_ur_pause_key) then
begin
while not IsKeyDown(assign_ur_resume_key) do
wait(1);
end;
end;
Highly unreliable since it won't be called within SRL procedures/functions.
he want to pause it not terminate it, terminate=stop.
If you like IsKeyDown so much, you can also try:
procedure Pause;
begin
if IsKeyDown(assign_ur_pause_key) then
begin
while not IsKeyDown(assign_ur_resume_key) do
wait(1);
end;
end;
Highly unreliable since it won't be called within SRL procedures/functions.
This will just make it loop waits until it gets a keypress, thereby blocking my entire main loop again and again. No thanks. I just wondered if there was a similiar function like TerminateScript but then to pause it. I guess there isn't. Thanks for the help guys!
This will just make it loop waits until it gets a keypress, thereby blocking my entire main loop again and again. No thanks. I just wondered if there was a similiar function like TerminateScript but then to pause it. I guess there isn't. Thanks for the help guys!
Huh? it only loop wait when you press the pause key (which u can assign any key as it), and break out of the loop once you press the resume key. Isn't that what u wanted? (pausing a script is equivalent to doing Wait/Sleep) But you will have to call this in every single place in order for it to work whenever you want. Unless simba starts supporting multithreading...
m3gaman3g3nd
08-14-2012, 06:23 AM
this is completely untested but this sounds like what your trying to accomplish
function yourfunction: boolean;
begin
if iskeydown(vk_up) then
exit else
begin
//blahhhhhhhhhhhhhh
//blahhhhhhhhhhhhhh
end;
end;
the exit function just simply exits the function where specified...
im not sure but you said pause?? well actually yes that means that the whole script will pause... to do this you may want to consitter this way
function pausescript:boolean;
begin
if iskeydown(vk_up) then
begin
repeat
wait(10)//for evil cpu sucking
until(iskeydown(vk_up)
end;
end;
you can stick this anywhere theres a loop otherwise it will not be called
this is completely untested but this sounds like what your trying to accomplish
function yourfunction: boolean;
begin
if iskeydown(vk_up) then
exit else
begin
//blahhhhhhhhhhhhhh
//blahhhhhhhhhhhhhh
end;
end;
the exit function just simply exits the function where specified...
im not sure but you said pause?? well actually yes that means that the whole script will pause... to do this you may want to consitter this way
function pausescript:boolean;
begin
if iskeydown(vk_up) then
begin
repeat
wait(10)//for evil cpu sucking
until(iskeydown(vk_up)
end;
end;
you can stick this anywhere theres a loop otherwise it will not be called
Hmm so what's the difference b/w ur code and mine? Other than that you have 'spiraling' standards and a boolean that is not used :rolleyes:
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.