SRL Archive - OSR Help

Need help perfecting my script


includer100

2013-03-26 06:10:46

I have developed a really good script that earns around 40k xp an hour in a no random zone, but every now and then, it just doesn't click until I disable then enable SMART.
Also, When my character gains a level it stops, and doesn't realise it has stopped training.
Is there anyway for my script to detect if it hasn't gained xp for a minute or so, or if it hasn't gained an item in a minute or so?
If not any suggestions as to what I could do?
I don't want to release any more information about my script yet until it is working Perfect.
Will also want to restrict how many people can use it, if your suggestions makes that finishing touch then you can have a copy!
Thanks for any help.


EDIT:so far it is dealt with by being logged out for inactivity then logging itself back in, but I think it is a big red flag if it gets forced out every time it levels up.

Syden

2013-03-26 06:13:29

You could try making it check the slots of your inventory for items, and then if it doesn't detect anything, it could re-run the procedures.

includer100

2013-03-26 06:18:15

From: Syden
You could try making it check the slots of your inventory for items, and then if it doesn't detect anything, it could re-run the procedures.


It may for example obtain 18 items, and then stop. Is there a way to check if the number of empty slots has changed in the last minute?

Syden

2013-03-26 06:22:47

You can make it check certain slots, 1-28. So if you had 18 slots filled, you could make it check from 18 on and decide whether or not there are items existing in those slots, and if there arent, re run the procedure. I think theres a few different functions that will check Slots or check remaining slots not filled. (I don't know them)

tealc

2013-03-26 06:25:09

im not too familar with the 07 includes here's an example for number of empty spaces in EOC


From: tehq
program Count;
{$DEFINE SMART}
{$i SRL/srl.simba}

Function InventoryFree: integer;
begin
Result := (28 - InvCount);
Writeln(Result);
end;

begin
TypeSend(IntToStr(InventoryFree));
end.

includer100

2013-03-26 06:28:09

The thing is if the last few slots are empty, it could just be they haven't filled yet, or it could be that it has stopped completely.
I noticed when I was using a woodcutting script it had a ChopWaitTime to check if it was chopping. Is it possible to have something like this for all skills?

Syden

2013-03-26 06:54:07

I believe that's just a procedure that tells it to wait a certain amount of time before trying to chop again; not actually checking if the player is chopping although it's assuming the player is chopping because it was told so. (if Chop = true; then ChopWaitTime) Or something along those lines.

I could be wrong though, try looking through the functions, there may be one.

includer100

2013-03-26 07:10:34

From: Syden
I believe that's just a procedure that tells it to wait a certain amount of time before trying to chop again; not actually checking if the player is chopping although it's assuming the player is chopping because it was told so. (if Chop = true; then ChopWaitTime) Or something along those lines.

I could be wrong though, try looking through the functions, there may be one.


Do you think I could get it to do an invent count every minute, and if invent count is not > than previous invent count, make it click again?

Total

2013-03-26 07:19:22

procedure a;
i, CutTimer : Integer;
begin
i := InvCount; // Stores how many items you have in your inventory in 'i'
MarkTime(CutTimer); // Marks a timer
if TimeFromMark(CutTimer) > 60000 then // Checks if the timer has been running for over a minute
if i = InvCount then // Checks if your inventory count is still the same as it was a minute ago
Writeln('Has been a minute and nothing has been added to the inventory.');
end;

I think you want something like that anyway. This is written with SRL-OSR and not P07Include though, not sure which you are using. Just make sure you MarkTime every time you get a log or whatever so it doesn't have to run through that.

includer100

2013-03-26 07:27:20

From: Total
procedure a;
i, CutTimer : Integer;
begin
i := InvCount; // Stores how many items you have in your inventory in 'i'
MarkTime(CutTimer); // Marks a timer
if TimeFromMark(CutTimer) > 60000 then // Checks if the timer has been running for over a minute
if i = InvCount then // Checks if your inventory count is still the same as it was a minute ago
Writeln('Has been a minute and nothing has been added to the inventory.');
end;

I think you want something like that anyway. This is written with SRL-OSR and not P07Include though, not sure which you are using. Just make sure you MarkTime every time you get a log or whatever so it doesn't have to run through that.



Ah this is exactly what I'm looking for but I'm using the P07 include. Would it take much work to convert it?

Total

2013-03-26 07:30:46

You should be able to just use P07_InvCount instead of InvCount for P07Include, so just change those and you should be good to go.

includer100

2013-03-26 07:42:43

From: Total
You should be able to just use P07_InvCount instead of InvCount for P07Include, so just change those and you should be good to go.


Ah good, got that script working. Is there a way to get it to start that procedure every minute? If i set it to start when cutting, it could cut a few more logs, then stop. The procedure will check and see that the inventory has increased so won't do anything, and my character will still stand there. Or how would I make it start the procedure every time it gets a new log?

Total

2013-03-26 07:48:00

If your inventory is open at all times you could just do something like this


if i < P07_InvCount then
begin
Writeln('Gained an item in inventory, resetting timer and inventory count');
MarkTime(CutTimer);
i := P07_InvCount;
end;

includer100

2013-03-26 08:23:49

From: Total
If your inventory is open at all times you could just do something like this


if i < P07_InvCount then
begin
Writeln('Gained an item in inventory, resetting timer and inventory count');
MarkTime(CutTimer);
i := P07_InvCount;
end;



Ok so I've made a procedure:

procedure CheckInvent;
begin;
i := P07_InvCount; // Stores how many items you have in your inventory in 'i'
MarkTime(CutTimer); // Marks a timer
if TimeFromMark(CutTimer) > 60000 then // Checks if the timer has been running for over a minute
if i = P07_InvCount then // Checks if your inventory count is still the same as it was a minute ago
CutTree;
if not i = P07_InvCount then
begin;
MarkTime(CutTimer);
i := P07_InvCount;
end;
end;


(cuttree is another procedure)

From what I understand this will make a timer, after 60 seconds it will check the invent and compare it to i
If it is the same as i, it will cut another tree.
If it is not the same as i, it will reset the timer do it again.

Do i just put the procedure at the start of my process list and it will loop endlessly?

Total

2013-03-26 08:31:03

You should implement the basic idea into your CutTree procedure instead of creating a new procedure for it because if you do it that way every time its called its going to remark the timer and it will never hit 1 minute.

includer100

2013-03-26 10:01:57

From: Total
You should implement the basic idea into your CutTree procedure instead of creating a new procedure for it because if you do it that way every time its called its going to remark the timer and it will never hit 1 minute.



Any suggestions as to where I'm going wrong here?

procedure CutTree;
begin;
if P07_FindObj(x, y, 'own', 6723505, 5) then
begin
ClickMouse2(mouse_left);
begin;
i := P07_InvCount; // Stores how many items you have in your inventory in 'i'
MarkTime(CutTimer); // Marks a timer
if TimeFromMark(CutTimer) > 60000 then // Checks if the timer has been running for over a minute
if i = P07_InvCount then // Checks if your inventory count is still the same as it was a minute ago
ClickMouse2(mouse_left);
if not i = P07_InvCount then
begin;
MarkTime(CutTimer);
i := P07_InvCount;
end;
end;

repeat
Wait(RandomRange(3000, 8000));
until not P07_IsUpTextMultiCustom(['Teak']) or(P07_InvFull);

end;
end;

Total

2013-03-26 18:36:17

From: includer100
Any suggestions as to where I'm going wrong here?

procedure CutTree;
begin;
if P07_FindObj(x, y, 'own', 6723505, 5) then
begin
ClickMouse2(mouse_left);
begin;
i := P07_InvCount; // Stores how many items you have in your inventory in 'i'
MarkTime(CutTimer); // Marks a timer
if TimeFromMark(CutTimer) > 60000 then // Checks if the timer has been running for over a minute
if i = P07_InvCount then // Checks if your inventory count is still the same as it was a minute ago
ClickMouse2(mouse_left);
if not i = P07_InvCount then
begin;
MarkTime(CutTimer);
i := P07_InvCount;
end;
end;

repeat
Wait(RandomRange(3000, 8000));
until not P07_IsUpTextMultiCustom(['Teak']) or(P07_InvFull);

end;
end;



procedure CutTree;
begin;
MarkTime(CutTimer);
i := P07_InvCount;
repeat
if P07_FindObj(x, y, 'own', 6723505, 5) then
ClickMouse2(mouse_left);
if TimeFromMark(CutTimer) > 60000 then
if i = P07_InvCount then
if P07_IsUpTextMultiCustom(['Teak']) then
ClickMouse2(mouse_left);
if not i = P07_InvCount then
begin;
MarkTime(CutTimer);
i := P07_InvCount;
end;

repeat
Wait(RandomRange(3000, 8000));
until not P07_IsUpTextMultiCustom(['Teak']) or(P07_InvFull);
end;
until P07_InvFull;
end;

Thats how I would do it.