SRL Archive - OSR Help

FindDead Help?


Ian

2012-11-02 19:48:00

Hey guys, I'm trying to use FindDead to go back to the spot where I am fighting. Right now I have this:
Procedure DeathCheck;

begin
If(FindDead) Then
begin
WriteLn('You died. Returning to rats..');
WalkToRats;
end else
exit;
end;

But it does not work. Am I doing something wrong?

Thanks

Rezozo

2012-11-02 20:52:59

Is there an error in the debug?
Also, I have never seen this function before. Where did you find it?

Edit: Found it. Check this: http://docs.villavu.com/srl-5/antiban.html

It says it 'Logs out and sets the current player to false if they are found dead. Will not logout if Reincarnate (global boolean) is set to true.'

Is that what you want to happen? Did you set Reincarnate to true?

Procedure DeathCheck;
Var Reincarnate:Boolean;
begin
Reincarnate:=true;

If(FindDead()) Then
begin
WriteLn('You died. Returning to rats..');
WalkToRats;
end else
exit;
end;

That should do it, try it out for me? Damn its hard to be helpful on a bad smartphone!

riwu

2012-11-02 21:09:57

Rezozo is right except that Reincarnate is already declared globally in the include so you shouldn't declare it again in your local routine. Simply declare it anywhere after SetupSRL, preferably just once.

Sin

2012-11-02 21:13:04


function IsDead:Boolean;
var
i:Integer;
begin
for i := 1 to 4 do
begin
Result := FindChatBoxText('dead',i,clBlack);
end;
end;

procedure XX;
begin
if IsDead then
begin
WalkBackToRats;
shithere;
end else
shithere;
end;

Ian

2012-11-02 21:26:18

Thanks guys, I'll try changing reincarnate to true. If that doesn't work then I'll use find black chat message :)

Rezozo

2012-11-02 21:28:32

I would do Shays only as a last resort. Many Many 'Black texts' ;)

@Riwu, My bad :P Forgot, so yea. BMWxi, don't declare it again, just change the value to true. :)
Good Sailing
~Joey

Sin

2012-11-02 21:34:08

From: Rezozo
I would do Shays only as a last resort. Many Many 'Black texts' ;)

@Riwu, My bad :P Forgot, so yea. BMWxi, don't declare it again, just change the value to true. :)
Good Sailing
~Joey


Wut?
It'll only result true if Dead is found.

Nebula

2012-11-02 21:44:01

What shay posted would actually work just fine if it broke out of the loop if the result is true.

function IsDead:Boolean;
var
i:Integer;
begin
for i := 1 to 4 do
begin
Result := FindChatBoxText('dead',i,clBlack);
if result then
break;
end;
end;

Although Reincarnate := true; would be shorter/do the same thing basically.

riwu

2012-11-02 22:01:21

What Shay and Nebula suggested would work if they expand the i to 8, or simply use IsChatBoxTextAnyLine, rather than searching only the first 4 lines (and the message is likely to appear at line 7-8 instead). Haha just joking they are great guys :p

Like Neb said, stick to the include function would be a better idea.

Rezozo

2012-11-02 22:01:38

@Neb How does his not get out of the loop? I see that it works well. In fact yours is longer…Cheers.

My bad Shay, wasn't thinking straight :P

I just think that adding the Reincarnate:=true; is slightly easier. Meant that if that doesn't work, he could always use yours. Its just longer :)

Sin

2012-11-02 22:08:27

From: Rezozo
@Neb How does his not get out of the loop? I see that it works well. In fact yours is longer…Cheers.

My bad Shay, wasn't thinking straight :P

I just think that adding the Reincarnate:=true; is slightly easier. Meant that if that doesn't work, he could always use yours. Its just longer :)


Nebs' is right on this account, forgot to add the break.

Rezozo

2012-11-02 22:17:32

It actually took me 15 whole minutes to find out what you meant…Jesus FML…
I see now…By bad Neb :P
Im just being stupid today…