SRL Archive - OSR Help

Help in Adding wait to a script.


tomjerry

2014-08-12 00:33:03

Hello Simba Community :),

BACKGROUND INFO:I am brand new to SIMBA boting so please bear with me.I will try to be as detailed as possible to try to make this easy for you guys. I have been running this fleching script in a web browser (https://villavu.com/forum/showthread.php?t=109071&p=1303538#post1303538). I will also attach the unmodified script to this thread. Now When I play runescape normally, there is no lag. But when I run a script with simba, runescape lags (eg freezes for 2-3 seconds after clicking a bank, etc.) I believe this happens because my pc is too old and slow but sadly I can not afford a fast pc.(I am a starving student, lol). So I am hoping this community can help me figure this out.

I have looked through the script and the script is able to cut logs or string bows. Right now I am only interested in cutting logs. So I looked at the different functions and several functions are related to cutting the log it seems. I also noticed the script uses sleep and wait commands which I believe might help me solve my problem.

THE PROBLEM: I noticed the script always gets stuck at same point at different times. Different times I believe because thats when the hardware of the computer is not able to keep up with software, in this case runescape and simba. The point at which the script gets stuck is : when mouse clicks the knife and log in inventory and is waiting for the menu to pop up to cut logs. I think the script messes up when the menu to cut logs takes too long to appear. After that the script keeps running and gets stuck saying in debug window "waiting for … seconds" (the time varies because script randomizes the time i guess) and runescape logs out to main screen due to inactivity.

I know this is the problem because I then dont stop the script and i manually log into runescape. Manually click on knife and log and bring mouse in "make longbow" region , the text turns white AND THEN! the script takes control of the mouse again and resumes.

SOLUTION?: If somehow I could tell the script to wait like 5 seconds everytime after it clicks the knife and log then this problem could be solved. However , I dont know how to do that. I tried putting wait and sleep commands at different places in the script but I fear I dont even know how to type them properly with correct syntax or anything because SIMBA kept giving errors due to my modifications. If someone could show me what command to put where and how to put it, that would be great.

This has been driving me crazy because sometimes the script runs good for 5 hours and sometimes only 15 minutes. Sometimes 4 hours, sometimes 1 hour. Totally random.

Thank you very much for reading and thanks in advance to SIMBA community for help.

Krazy_Meerkat

2014-08-12 03:10:12

From: tomjerry
Hello Simba Community :),

BACKGROUND INFO:I am brand new to SIMBA boting so please bear with me.I will try to be as detailed as possible to try to make this easy for you guys. I have been running this fleching script in a web browser (https://villavu.com/forum/showthread.php?t=109071&p=1303538#post1303538). I will also attach the unmodified script to this thread. Now When I play runescape normally, there is no lag. But when I run a script with simba, runescape lags (eg freezes for 2-3 seconds after clicking a bank, etc.) I believe this happens because my pc is too old and slow but sadly I can not afford a fast pc.(I am a starving student, lol). So I am hoping this community can help me figure this out.

I have looked through the script and the script is able to cut logs or string bows. Right now I am only interested in cutting logs. So I looked at the different functions and several functions are related to cutting the log it seems. I also noticed the script uses sleep and wait commands which I believe might help me solve my problem.

THE PROBLEM: I noticed the script always gets stuck at same point at different times. Different times I believe because thats when the hardware of the computer is not able to keep up with software, in this case runescape and simba. The point at which the script gets stuck is : when mouse clicks the knife and log in inventory and is waiting for the menu to pop up to cut logs. I think the script messes up when the menu to cut logs takes too long to appear. After that the script keeps running and gets stuck saying in debug window "waiting for … seconds" (the time varies because script randomizes the time i guess) and runescape logs out to main screen due to inactivity.

I know this is the problem because I then dont stop the script and i manually log into runescape. Manually click on knife and log and bring mouse in "make longbow" region , the text turns white AND THEN! the script takes control of the mouse again and resumes.

SOLUTION?: If somehow I could tell the script to wait like 5 seconds everytime after it clicks the knife and log then this problem could be solved. However , I dont know how to do that. I tried putting wait and sleep commands at different places in the script but I fear I dont even know how to type them properly with correct syntax or anything because SIMBA kept giving errors due to my modifications. If someone could show me what command to put where and how to put it, that would be great.

This has been driving me crazy because sometimes the script runs good for 5 hours and sometimes only 15 minutes. Sometimes 4 hours, sometimes 1 hour. Totally random.

Thank you very much for reading and thanks in advance to SIMBA community for help.


Hey mate, I've been there before lol.. I know you tried some stuff on your own, but this script is using a lot of functions from a custom-include so it might be a little hard to work with.. I'd recommend writing your own script, it's a lot easier to understand things that way.
To achieve you're desired outcome, open the script and place this at line 507:
wait(3500+random(500));  
1000 is about a second.. Increase if needed.

Flight already wrote a function to wait for that screen but I guess it's not working for you. When you learn just a little bit more, you can just add a loop to wait until that screen is visible (with a time-out ofc).

tomjerry

2014-08-13 16:02:53

The wait command works but sadly it didnt solve the issue. what i want to do is tell the script if i am not logged in , log me in. and if im logged in then do nothing. And also to tell the script to timeout and restart the cut log loop after certain amount of time has passed. How would i do that?

theorange

2014-08-13 16:24:21

From: tomjerry
The wait command works but sadly it didnt solve the issue. what i want to do is tell the script if i am not logged in , log me in. and if im logged in then do nothing. And also to tell the script to timeout and restart the cut log loop after certain amount of time has passed. How would i do that?


add
   if not isLoggedIn() then Exit; 
to the start of your functions/procedures.

add this


procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'LOGIN-EMAIL-HERE';
password := 'PASSWORD-HERE';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;

then in the main loop

repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

YOUR FUNCTIONs/PROCEDURES - The ones you want to loop through
until SOMECONDITIONHERE;

Flight

2014-08-13 19:32:15

In this script, line 508 is where it waits for the Fletching menu to appear in the chat box:

if (WaitChatChange()) then begin
…and if you venture into Chat.simba (Includes>AeroLib>core>Chat.simba) you'll find the "waitChatChange()" function which, by default, waits for a maximum of 5,000ms (5 seconds). The simplest solution? Change that 5 second limit to 10 seconds (10,000) in Chat.simba. It's much more elegant than simply having the script wait statically forr the fletching screen to appear after using the knife on the logs. Try that first and see how it performs for you.

tomjerry

2014-08-13 21:31:57

@Flight: When i added wait on line 507 as suggested by krazy_meerkat , it Solved the lag problem that was happening after using knife on log. However I noticed the computer freezes for 2-3 seconds RIGHT AFTER THAT so the problem was not at the point of using knife on log but the stuff that happens RIGHT AFTER THAT. I am not sure how I can fix it… I am so lost.

To sum up my problem in concise brief manner: I need to put something in this script that constantly checks if the script is stuck for long period of time (2 minutes about) and if it is, it should log me out and start over. Can some one help me implement this into script?

tomjerry

2014-08-13 21:44:02

From: theorange
add
   if not isLoggedIn() then Exit; 
to the start of your functions/procedures.

add this


procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'LOGIN-EMAIL-HERE';
password := 'PASSWORD-HERE';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;

then in the main loop

repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

YOUR FUNCTIONs/PROCEDURES - The ones you want to loop through
until SOMECONDITIONHERE;


Isnt this for rs3? Cuz i see squeal of fortune there

The Spark

2014-08-13 22:00:37

From: tomjerry
Isnt this for rs3? Cuz i see squeal of fortune there


It is, I dont think orange realized this thread was for old school runescape. He should probably read where the thread is located before posting something :P

Flight

2014-08-13 22:20:50

From: tomjerry
… so the problem was not at the point of using knife on log but the stuff that happens RIGHT AFTER THAT. I am not sure how I can fix it… I am so lost.


Ok so the script uses the knife on the log, the fletching menu comes up, then what? Does the script successfully right-click and choose the option "Make X"? If so does it correctly type in "33" into the dialogue box? If so does the script wait until all the logs are cut? Walk me through it.

Edit:
By the way I have to head out for a little while right now, hopefully back within a hour or so.

tomjerry

2014-08-14 00:14:19

From: Flight
Ok so the script uses the knife on the log, the fletching menu comes up, then what? Does the script successfully right-click and choose the option "Make X"? If so does it correctly type in "33" into the dialogue box? If so does the script wait until all the logs are cut? Walk me through it.

Edit:
By the way I have to head out for a little while right now, hopefully back within a hour or so.


@Flight: the script does everything fine like the steps you mentioned, however, It is never able to run infinitely which I want it to until I press the stop button in simba. Lets say i start the script with 5k logs. It is never able to get through all of them. Max it has got through was like 2k logs. , It could rune fine for 5 hours or 1 hour or 10 minutes or 3 hours. Its random.

I will explain the situation: Under normal circumstances, In the debug box, it always says "have knife, have log, fleching", then next line always is "waiting for 147" (the number "147" varies, sometimes it could be 130, 140 etc, i guess the scipt randomly picks it?) so the script waits until all the logs in inventory are cut then clicks on bank and repeats the procedure over and over again and debug box keeps progressing which is good.

THE PROBLEM IS: When I come back to my computer I see runescape log in page(with the flames and stuff) and I check SIMBA and I see the script hasnt stoped or anything. its still running with the debug box HANGING on "have knife, have log, fleching", then next line is "waiting for 147 seconds" After this point the debug box does not progress forward. "Waiting for 147 seconds" is the last line i see in the debug box. Also "waiting for 147" is not spammed over and over in debug box. There is only mention of it once like normal use.

So i log back in and manually bring my mouse to click on knife and log and hover to region saying make long bow and then SIMBA takes over control of the mouse and progresses normally while populating the debug box like it always does when the script is running fine.

Now I dont know what causes the script to randomly get stuck at "waiting for 147" in the debug box. May be to solve this would be to tell the script at every step to check if i am at login screen and if i am then log me back in and start all over. But i have no idea how to do that.

Flight

2014-08-14 00:29:57

Seems like the script simply lacks failsafes. A well-built script with a high use of failsafes will be extremely stable. My Abyssal Runecrafter will stay running to 12 hours (I shut off when I go to sleep) and there's a million and a half scenarios in which something could go wrong while crafting runes at the abyss. With that being said you'll have to either report your problems to the scripter writer his/her self, request another similar script be made, or begin creating your own.

tomjerry

2014-08-14 11:00:33

From: Flight
Seems like the script simply lacks failsafes. A well-built script with a high use of failsafes will be extremely stable. My Abyssal Runecrafter will stay running to 12 hours (I shut off when I go to sleep) and there's a million and a half scenarios in which something could go wrong while crafting runes at the abyss. With that being said you'll have to either report your problems to the scripter writer his/her self, request another similar script be made, or begin creating your own.


Ok thanks everyone :(