SRL Archive - OSR Help

My burning method is flawed--- Help Please!


Hazzah

2012-04-09 23:38:51

So I have been attempting to make a house burner (that uses the demon butler) for a while now. It is essentially the first script I have seriously tried to write, but my method for burning is slightly flawed and I am not sure how to fix it.


procedure Burning;

var
LogToBurnDTM,x,y:integer;

begin
LogToBurnDTM:= DTMFromString('m1gAAAHic42JgYHBiYmDwAWI/IA6Ess2B2BGIzYDYGohdgZiTkYHhH1A9E5DmAmIBIBYCYhEgZgdiBqi8ux4XSBUGNlBQQOH/ZyAOMBKJEQAARvoHJA==');
if FindDTM(LogToBurnDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
Repeat
begin
Mouse(x,y,0,0,false);
Wait(RandomRange(150,255));
ChooseOption('ight');
wait(RandomRange(1335,1355));
if FindBlackChatMessage('light a fire here') then
begin
mouse(627,86,5,5, True);
wait(RandomRange(1305,1370));
end;
end;
until(Not(FindDTM(LogToBurnDTM,x,y,MIX1,MIY1,MIX2,MIY2)));
if (Not(FindDTM(LogToBurnDTM,x,y,MIX1,MIY1,MIX2,MIY2))) then
FreeDTM(LogToBurnDTM);
end;

Not, this works, if it does not try to burn in the same path that it just did, however, the way I have the walking set up right now it finds its previous burn path quite frequently. The problem then arises that it will always

if FindBlackChatMessage('light a fire here') then

because once it is there, it always finds it. Is there a way that I could make it relocate and continue burning more efficiently so that it isn't constantly finding the same "Black Chat Message"?

Any help would be appreciated!

Littellj

2012-04-09 23:47:59

You could make 3 or so paths and then just cycle through the 3, have one north of the other. So that you never have to look for the chat. Plus find black chat sucks -.-

I've also had to take a break from my script for the same reason. One suggestion that was given to me was to check to see if you find the logs color in a box near your feet.

Hazzah

2012-04-09 23:57:01

From: Littellj
You could make 3 or so paths and then just cycle through the 3, have one north of the other. So that you never have to look for the chat. Plus find black chat sucks -.-

I've also had to take a break from my script for the same reason. One suggestion that was given to me was to check to see if you find the logs color in a box near your feet.


Seems like there would be a more elegant solution than making three different paths but I will give it a try.

EDIT: I created three paths, but I am unsure how to encorporate them into my mainloop.

procedure MainLoop;
Begin
if invcount <2 then
begin
FindButler;
RunningToSpot1; or RunningToSpot2; or RunningToSpot3;
end;
if invcount >1 then
begin
Burning;
end;
end;


I know this doesn't compile/run, but it's just so someone can see the procedure names and way I have it set up to hopefully give me a suggestion.

Getdropped

2012-04-10 08:22:11

To incorporate these paths just have it do something like:

repeat <—-mainloop
walkpath1;
doburning;
bank;
walkpath2
doburning;
bank;
walkpath3;
doburning;
until(not(loggedin))

however I feel the best way most likely to do this is to use the burn like logs and then check for the box text it would be more efficient. Hope I helped ;)

Hazzah

2012-04-10 09:17:46

I ended up doing something similair, except I made my MainLoop as I had it before into a double of Loops

procedure MainLoopMain;
Begin
Loop1;
//Loop2;
Loop3;
end;

Abu

2012-04-10 09:20:34

I'm not sure how this works(I'm not a member), but I've been faced with a similar problem in a fire making function.
What I did, is Wait(5000) then check if the inventory count has reduced by one, if it has, it means I've burned that log, if it hasn't, I need to burn the log somewhere else.

Littellj

2012-04-10 12:21:22

From: Hazzah
I ended up doing something similair, except I made my MainLoop as I had it before into a double of Loops

procedure MainLoopMain;
Begin
Loop1;
//Loop2;
Loop3;
end;


Uh, I'm sure there is some super code way to do it. (probably with for 0-2 to loop) or something, But I to am an amateur. The way you have it here should work. Lets be honest real players know where there is a line of fire before standing on it. Doing it like this would most likely be more human like. Doing 3 paths instead of 2 would just be an extra "failsafe" giving more time for the fire to burnout:fiery:. Hope i helped :spot:

J J

2012-04-11 13:41:36

You can probably learn something from this, added some helpful things I'd say.

{ Failsafe when standing on a fire }
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.62);
if FindColorSpiralTolerance(X, Y, 536379, 244, 159, 276, 193, 3) then // This searches for the brown-ish logs on the RS screen, will probably work for every type of logs, it checks in a small area around the player
{ Standing in a fire, moving }
begin;
MouseBox(211, 99, 318, 161, 1); // Randomly clicks somewhere north/west, north or north/east of the player
Wait(1200 + Random(800)); // Waits a while
end;
{ Light a log }
Logs := DTMFromString('mAAEAAHiclcvBCkBAFIXhY9aewjNIyUISK5Pm8SeUhbJB3oC/WFiaW9+pU+fGkmojVciRIX2V6OBg0aLBws+AEbOevuPEhhUTPA70RUJGv11Ba8kE7r93A1hgD7U=');
if FindDTM(Logs, X, Y, MIX1, MIY1, MIX2, MIY2) then //if it finds the DTM for logs it will do this
begin
MMouse(X, Y, 2, 2); // Moves the mouse to the DTM with a randomness of 2 x
Mouse(X, Y, 0, 0, 0); // Right clicks the logs because I have tinderbox on my toolbelt
WaitOptionMulti(['ight', 'Light'], 150); // Waits up to 150 ms for the option ight or Light to appear
Wait(600 + Random(300)); // Waits 600 ms + random 300 ms
end;
FreeDTM(Logs); // Free's the DTM to avoid memory leaking
{ Check for fire animation }
PBox := IntToBox(282, 145, 320, 195); // This is a box just around the attempting of the fire. Be sure to have your screen all the way up and totally north to make it work with this box
FindNormalRandoms; // Looks if it is in a random
Marktime(q); //Start a time marker
repeat
Wait(100 + Random(100));
Antiban; // waits 100+random 100 ms and antiban and another 100+random100 ms until it finds an animation/pixel shift that means that the log has been lit
Wait(100 + Random(100));
until (Animating(PBox, 100, 200)) or (TimeFromMark(q)>10000); / this is the animation in the box around the character, failsafe is if the time from the timer has been more than 10 seconds, lower this if needed
WriteLn('We have ignited a log')
Wait(150 + Random(250));

Try to experiment with the size of the PBox and the animation numbers to make it work for your own script. Might want to edit the color aswell :P It's made for oak logs.

Summarized:
This procedure will burn a log and wait until it finds and animation. I figured out the animation numbers and the box myself, just play around with the settings to make it work for you. Once it detects the animation it will end the loop. A failsafe is a timer because it might loop until infinity otherwise.. eg. if the script has misclicked it will never light a log.