SRL Archive - OSR Help

How would I do this?


John S

2011-11-04 17:35:42

So I'm creating my first little bot, and I decided to use the easiest skill. Firemaking :garfield:

So I'm using just using bitmaps to click the logs, then move on to the tinderbox. That works fine. Then I use a repeat to check if the text "he fire" appears in the chatbox coords, which works fine, up until I already light one. Then it'll find it again the next go around, and keep using the tinderbox with the logs, because it see's the firemaking text from the last log it burned.

I tried thinking of a way to circumvent, but I don't have any foolproof ideas unless I use a counter of how many times it's in the chatbox. And I don't know how to do that D:

Here's the repeat portion of the procedure,

repeat

if(FindBitmap(Logs, x, y)) then
Mouse(x, y, 4, 4, true);
wait(Random(500));
if(FindBitmap(Tindy, x, y)) then
Mouse(x, y, 3, 3, true);
repeat
begin
if(FindText(xi, yi, 'he fire', SmallChars, MCX1, MCY1, MCX2, MCY2))then
begin
break;
end else
begin
Wait(Random(1000));
end;
end;
until
i > 1000;

until
InvCount = 2;

PatDuffy

2011-11-04 17:47:55

For the
until
i > 1000;

What are you using for the value of i? Because, unless I'm misreading it, your code will keep repeating looking for the text in the chatbox until whatever the value of i is greater than 1000.

John S

2011-11-04 17:52:56

I only put that in because I wanted it to repeat back through if the text didn't show up. Only so I could utilize the wait function and not have it checking for text every single loop without a wait, as I broke the loop if the text was found. And partially because I don't know what else I could do.

BraK

2011-11-04 17:56:09

Heh Firemaking is one of the harder starting scripts ;) Goodluck to you sir!

John S

2011-11-04 18:06:10

From: BraK
Heh Firemaking is one of the harder starting scripts ;) Goodluck to you sir!


Really? D: I thought it'd be more easy since it's point and click.

Oh wait, that's what all RS is ;D. But hell, i'm sticking with it and I'll finish it. Hopefully. Crossing fingers.

PatDuffy

2011-11-04 18:09:06

First you could remove some of the un-needed code just to shorten things up(i'm just kinda ocd about that).
 if(FindBitmap(Tindy, x, y)) then
Mouse(x, y, 3, 3, true);
repeat
if(FindText(xi, yi, 'he fire', SmallChars, MCX1, MCY1, MCX2, MCY2))then
break;
else
Wait(Random(1000));
until
i > 1000;

until
InvCount = 2;
That should still compile.

As to your problem, upon reading the description of FindText in the Include, you used it correctly, but your current parameters will search the entire chat box for the text.
Description: Searches for text in specified box with specified font.
Try changing the specified box to be only the bottom line if you want it to ignore the previous messages?

Sir R. M8gic1an

2011-11-04 18:26:16

There's a function in text.scar, something like GetChatBoxLine…

just use that to check what ur character is doing.

'attempt to light'
'lit a fire'

That should get you through…

Also, the last chatboxline is 8

-RM

John S

2011-11-04 18:27:18

It didn't compile D:
[Error] (29:9): Identifier expected at line 28

The error is at the else, right under break;

I tried that, but it would still use the text already there from the previous logs that have been lighted, unless someone talks or something else takes the spot of that line. I think it'd just be a bit odd to have the character say something right after it lights a fire everytime ;D

@Magician,

I found something similar under chat.scar, would it do the same?

KingKong

2011-11-04 19:54:46

From: John S

So I'm using just using bitmaps to click the logs, then move on to the tinderbox. That works fine. Then I use a repeat to check if the text "he fire" appears in the chatbox coords, which works fine, up until I already light one. Then it'll find it again the next go around, and keep using the tinderbox with the logs, because it see's the firemaking text from the last log it burned.

I tried thinking of a way to circumvent, but I don't have any foolproof ideas unless I use a counter of how many times it's in the chatbox. And I don't know how to do that D:


if you want to know whether or not you successfully burnt a log, open up the XP counter on the Minimap and store the xp gained, then after clicking the tinderbox on the log wait until the xp gained increases.