SRL Archive - SRL Archives

The Fix for DoEmote


Naum

2009-05-29 13:39:50

DoEmote wasn't working and 9 new emotes had been added,

I've tested this and it works :)

Procedure DoEmote(EmoteNumber : Integer);
Var Ex, Ey, Row, Col : Integer;
Begin
If (EmoteNumber / 46 > 1) Or (EmoteNumber * 34729237 = 0) Then
Begin
srl_Warn('DoEmote', 'Invalid EmoteNumber: ' + IntToStr(EmoteNumber) + ', Valid Emotes: 1..46', warn_AllVersions);
Exit;
End;
GameTab(12);

If EmoteNumber <= 20 Then
If GetColor(724, 222) = 1975337 Then
Mouse(724, 233, 5, 5, True);

If InRange(EmoteNumber, 21, 40) Then
Begin
If GetColor(727, 360) = 2106924 Then
Mouse(727, 360, 5, 5, True);
EmoteNumber := EmoteNumber - 20;
End;

If InRange(EmoteNumber, 41, 46) Then
Begin
If GetColor(723, 443) = 1975337 Then
Mouse(723, 443, 3, 3, True);
EmoteNumber := EmoteNumber - 28;
End;

Row := (Trunc(EmoteNumber / 4) + 1);
If EmoteNumber Mod 4 = 0 Then Dec(Row);
Col := EmoteNumber Mod 4;
If Col = 0 Then Col := 4;

Ex := 562 + 37 * (Col - 1);
Ey := 231 + 44 * (Row - 1);

If CountColor(65536, Ex, Ey, Ex + 37, Ey + 44) >= 5 Then
Begin
Mouse(Ex, Ey, 23, 25, True);
Wait(1200 + Random(700));
End;
End;

Feel free to attack it :)

Edit:

I tried doing it in cases but that failed :(

I set EmoteNumber as mask at the end because I edited the variable :p, during script run time.

ian.

2009-05-29 13:47:18

Did you try if then's in cases? Or vice versa? :p

Not that important, but a case would look better in my opinion.

Naum

2009-05-29 13:51:28

Yeah, I did, It failed :(. It's in first post btw.

Hey *I thought you left??*

Dark Arcana

2009-05-29 13:55:08

From: NaumanAkhlaQ
Yeah, I did, It failed :(. It's in first post btw.

Hey *I thought you left??*


Here is the thread http://www.villavu.com/forum/showthread.php?t=45888

ian.

2009-05-29 13:58:26

I saw, but you might not have tried cases in cases, if then's in cases, etc.

Dynamite

2009-05-29 14:13:46

99_ come on msn! :D

T~M

Naum

2009-05-29 16:12:20

Cases won't work, they take too long :)

Nava2

2009-05-29 16:54:51

Why reassign the variable EmoteNumber.. its not passed out of the procedure.

Whats with the First if statement, why not use InRange?

Naum

2009-05-29 17:31:35

1st question: I re-assigned the emote number variable as I thought it would be modified because I minus numbers from the exact variable.

For example I did:

EmoteN := 21; 
DoEmote(EmoteN);
WriteLn(EmoteN +'Emote we did :)');

If I didn't re-assign it it would be 1. I don't want that number to change, that's why I had the mask variable.

EDIT: 1st question in post.

2nd question: I use an If statement, I think it's shorter but your the boss :).

senrath

2009-05-29 17:35:25

From: NaumanAkhlaQ
1st question: I re-assigned the emote number variable as I thought it would be modified because I minus numbers from the exact variable.

For example I did:

EmoteN := 21; 
DoEmote(EmoteN);
WriteLn(EmoteN +'Emote we did :)');

If I didn't re-assign it it would be 1. I don't want that number to change, that's why I had the mask variable.

EDIT: 1st question in post.

2nd question: I use an If statement, I think it's shorter but your the boss :).

Actually, it shouldn't change anything you put into it, since you're passing by value, not by reference.

Naum

2009-05-29 18:06:56

From: senrath
Actually, it shouldn't change anything you put into it, since you're passing by value, not by reference.


Are you sure?

Thanks for clearing it up, son :)