SRL Archive - Reflection Development

Update 8/19/11


Drakan

2011-08-19 11:40:42

As we near closer to the full take-over of reflection 2 and the extinction of reflection 1, I want to keep everyone up to date on changes and get more discussion and involvement from the community. A lot of progress has truly been made in reflection 2. The rewrite has left things faster and generally more stable. Antirandoms are better than ever (big thanks to mormonman for handling a lot of those). This include should help us get closer to the java bots in efficiency and speed, but still give the learning environment and coding practices that SRL aims for. I'm grateful for everyone's contributions and support!

I want to start logging changes like coh3n does for MSI. Meaning, making a post and allowing discussion about the changes or updates take place. So I want your opinions on this: do you think Reflection 2 is ready for a full release? What sort of things would you like to see added or fixed before it is released? Are there any bugs that you have encountered while using Reflection 2?

Reflection 2 Commit Today:
Added SetupReflection to Reflection.simba. You call this in place of SetupSRL, since it does all of the necessary SRL setup in there as well. Took care of annoying hints at compile time, added larger wait in WalkPath to hopefully reduce CPU usage during that function.


I wanted to post this here as well to let script developers that are using Reflection 2 know that they need to change the way their script sets up. You no longer need to call SetupSRL, just call SetupReflection. This will also take care of updating hooks and setting up the reflection Randoms. Please make this change in your scripts.

Flight

2011-08-19 11:46:41

I'm excited. :) Reflection 2 is, without a doubt to me, ready to take over the scene. All that I can think of off the top of my head would be finishing up the last one or two anti-randoms and rewards handling. I assume the Reflection extension will also be updated accordingly?

I believe anything else major will just be updates or add-ons to Reflection2, but it's definitely more than ready for a full official release and replacement of the current Reflection. I mean after all, just because it'll be released officially, doesn't mean it won't still be worked on from time to time. ;)

Drakan

2011-08-19 11:53:01

I agree with you, I just want to make sure there are no major bugs or features missing that would hinder scripts and the likes. Also mormonman has finished evil bob and almost done with rewards. Unfortunately prison pete will not be completed until reflection 2.1 (which I will make a post about eventually, and yes I already have major plans for that :P).

Flight

2011-08-19 12:04:42

From: Drakan
I agree with you, I just want to make sure there are no major bugs or features missing that would hinder scripts and the likes. Also mormonman has finished evil bob and almost done with rewards. Unfortunately prison pete will not be completed until reflection 2.1 (which I will make a post about eventually, and yes I already have major plans for that :P).


Must be something to do with models. :drool:

Drakan

2011-08-19 12:16:15

From: Flight
Must be something to do with models. :drool:


It is actually ;) And, in my opinion, things better than models.

Yago

2011-08-19 13:46:07

With setup reflection do we still have to call updatehooks?

Drakan

2011-08-19 13:51:38

From: Yago
With setup reflection do we still have to call updatehooks?


Nope, its called inside of SetupReflection.

Yago

2011-08-19 13:54:25

OK thanks. I think its about ready to be released. The next project sould be models imo…

It just hit me — Good job guys!!! you guys really rock :p

bolshak25

2011-08-19 14:33:10

if prison isnt going to be done right away, will you have it detect that you are in it and call the color solver for the time being, because we dont have the reflection solver for now?

that would help scripts continue to go

Yago

2011-08-19 14:36:34

From: bolshak25
if prison isnt going to be done right away, will you have it detect that you are in it and call the color solver for the time being, because we dont have the reflection solver for now?

that would help scripts continue to go


I don't think the color solver is working for that one. A color solver would be hard…

Brandon

2011-08-19 14:54:35

//Canifis
BankTiles[18] := [Point(3513, 3478), Point(3513, 3479), Point(3513, 3480),
Point(3513, 3481), Point(3513, 3482), Point(3513, 3483)];

Drakan

2011-08-19 15:14:33

From: bolshak25
if prison isnt going to be done right away, will you have it detect that you are in it and call the color solver for the time being, because we dont have the reflection solver for now?

that would help scripts continue to go


I dont think the color solver works either. Right now it will disable the player and log it out.

@ggzz: Added and committed, thanks.

gerauchert

2011-08-19 17:41:30

Are there any bugs that you have encountered while using Reflection 2?


R_GetDest is not returning correct tile positions, for example, this returned:


R_WalkToTileEx(SafePath[1],2,0,False);
if R_FlagExists then
begin
til := R_GetDest;
Writeln(IntToStr(SafePath[1].x) + ',' + IntToStr(SafePath[1].y));
Writeln(IntToStr(til.x) + ',' + IntToStr(til.y));
while R_FlagExists do
Wait(100);
end;

This:


3087,3507
50,54

pyroryan

2011-08-19 18:03:07

GETDESTX = "getDestY";
GETDESTY = "getDestX";
My bad…..fixing.

Edit:
Fixed.

gerauchert

2011-08-20 19:54:59

From: pyroryan
GETDESTX = "getDestY";
GETDESTY = "getDestX";
My bad…..fixing.

Edit:
Fixed.


Still isn't working for me… :( it returned 44,57

mormonman

2011-08-20 20:56:17

It's returning the values for the local tile. If you want to use it for the global tiles, add:

LocDest := R_GetDest;
Dest.x := SmartGetFieldInt(0, hook_static_BaseX) + LocDest.x;
Dest.y := SmartGetFieldInt(0, hook_static_BaseY) + LocDest.y;

Brandon

2011-08-20 22:13:00

From: mormonman
It's returning the values for the local tile. If you want to use it for the global tiles..


OT:
Whats the difference between the two: Global Tile vs Local Tile? When do I use it and do I need it?

Other stuff
Useful:
R_GetMMLevels does not have Summoning Points.. and Equipment Bounds are missing from TEquipmentItem. Oh and I was wondering why we switch tabs when using R_GetEquipment because the functions can determine equipment without switching tabs :S Should be that the function determines whats equipped and if the user wants to switch tabs then they can? No? Bad idea?

Summoning MM:

INTERFACE_SUMMONING:= 747;
SummoningPoints:= StrToInt(R_GetInterfaceText(INTERFACE_SUMMONING, 5));
Reflection Version:

function R_HPPercent: Integer;
begin
if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] < 1) then
Players[CurrentPlayer].Level[SKILL_HITPOINTS] := Max(1, R_GetSkillLevel(3));

if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] > 1) then
Result := Round(R_GetMMLevels('hp') * 10 / Players[CurrentPlayer].Level[SKILL_HITPOINTS])
else
Result := -1;
end;
Reflection Version:

procedure R_Retaliate(RetTrue: Boolean);
Var
X, Y: Integer;
Child: TInterfaceChild;
Begin
if (R_CurrentGameTab <> RTAB_COMBAT) then
begin
R_GameTab(RTAB_COMBAT);
Wait(500 + Random(500));
end;
Child:= R_GetInterfaceChild(884, 16);
if (RetTrue) xor (Child.TextureID = 656) then
MouseBox(Child.Bounds.X1, Child.Bounds.Y1, Child.Bounds.X2, Child.Bounds.Y2, 1);
End;
Useful:

Function IsPoisoned: Boolean;
begin
Child:= R_GetInterfaceChild(748, 4);
if(Child.TextureID = 1801) then
Result:= true;
end;
Equipment (Could be used for an R_GetEquippedItemBounds):

Width := SmartGetFieldInt(Child, hook_interface_GetWidth);
Height := SmartGetFieldInt(Child, hook_interface_GetHeight);

Result.Bounds:= IntToBox(X, Y, X+Width, Y+Height);

Oh and Please add NPC Models/Character Model ID's.. And add R_GetObjectsAt.. that way it gives a TRSObjectArray.

Flight

2011-08-20 22:16:28

From: ggzz
OT:
Whats the difference between the two: Global Tile vs Local Tile? When do I use it and do I need it?

Also can u check these hooks because my scripts all stop and say field not found:

hook_menu_Action = 'x';
hook_menu_Option = 'C';
hook_interface_GetText = 'D';


Other stuff
Useful:
R_GetMMLevels does not have Summoning Points.. and Equipment Bounds are missing from TEquipmentItem.

Summoning MM:

INTERFACE_SUMMONING:= 747;
SummoningPoints:= StrToInt(R_GetInterfaceText(INTERFACE_SUMMONING, 5));
Reflection Version:

function R_HPPercent: Integer;
begin
if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] < 1) then
Players[CurrentPlayer].Level[SKILL_HITPOINTS] := Max(1, R_GetSkillLevel(3));

if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] > 1) then
Result := Round(R_GetMMLevels('hp') * 10 / Players[CurrentPlayer].Level[SKILL_HITPOINTS])
else
Result := -1;
end;
Reflection Version:

procedure R_Retaliate(RetTrue: Boolean);
Var
X, Y: Integer;
Child: TInterfaceChild;
Begin
if (R_CurrentGameTab <> RTAB_COMBAT) then
begin
R_GameTab(RTAB_COMBAT);
Wait(500 + Random(500));
end;
Child:= R_GetInterfaceChild(884, 16);
if (RetTrue) xor (Child.TextureID = 656) then
MouseBox(Child.Bounds.X1, Child.Bounds.Y1, Child.Bounds.X2, Child.Bounds.Y2, 1);
End;
Useful:

Function IsPoisoned: Boolean;
begin
Child:= R_GetInterfaceChild(748, 4);
if(Child.TextureID = 1801) then
Result:= true;
end;


Very useful! Repz+

mormonman

2011-08-20 22:23:46

Local tile is the one in the 104x104 chunk of runescape that is loaded at the time.
Global means it is that specific tile on the whole of runescape.

Echo_

2011-08-21 09:59:01

The updater extension in Simba needs to be updated, this piece specifically:

  if (AddUpdater('Reflection', 'http://wizzup.org/static/srl/srlref.tar.bz2', 'http://wizzup.org/static/srl/srl_refl_version', IncludePath, True, True, Refl)) then
begin
UpdaterArr[Refl].Hooks[ATTACH_HOOK] := @OpenDefMenu;
end;
end;

gerauchert

2011-08-21 11:44:37

From: mormonman
It's returning the values for the local tile. If you want to use it for the global tiles, add:

LocDest := R_GetDest;
Dest.x := SmartGetFieldInt(0, hook_static_BaseX) + LocDest.x;
Dest.y := SmartGetFieldInt(0, hook_static_BaseY) + LocDest.y;


Hah, I never knew there were local and global tiles :redface: …. thanks for the help man!

Flight

2011-08-21 12:20:18

From: mormonman
Local tile is the one in the 104x104 chunk of runescape that is loaded at the time.
Global means it is that specific tile on the whole of runescape.


This is handy. :o Infact, this might solve my dynamic tiles issue for doing quests.

Drakan

2011-08-22 18:37:33

From: Flight
This is handy. :o Infact, this might solve my dynamic tiles issue for doing quests.


I don't see how, it makes no difference really :P Just do simple adding and subtracting from the source tile to calculate where you need to go :P.

@ggzz: As far as the tabbing goes while returning equipment, the interface doesn't refresh unless you tab to it and load the info there. So if you equip something, the interface info won't change till you tab to it. Just like the inventory. You still have to tab in order to check. The hooks for getting your character equipment is different, as those pull the ids from what you visually can see (e.g. what you're wearing). This is good for getting the ids of MOST of the equipment, but won't work for things like rings and ammo.

NPC Models will not be added until reflection 2.1. Thanks for the other suggestions though! Really helpful.


@Echo: Well of course but we won't change that until the release :P

Brandon

2011-08-22 20:03:06

From: Drakan
I don't see how, it makes no difference really :P Just do simple adding and subtracting from the source tile to calculate where you need to go :P.

@ggzz: As far as the tabbing goes while returning equipment, the interface doesn't refresh unless you tab to it and load the info there. So if you equip something, the interface info won't change till you tab to it. Just like the inventory. You still have to tab in order to check. The hooks for getting your character equipment is different, as those pull the ids from what you visually can see (e.g. what you're wearing). This is good for getting the ids of MOST of the equipment, but won't work for things like rings and ammo.

NPC Models will not be added until reflection 2.1. Thanks for the other suggestions though! Really helpful.


@Echo: Well of course but we won't change that until the release :P



Ohhhhh I see I thought that the refreshing might be why but I also thought it actually just hooked right into it kinda like the R_GetSkillLevels. Guess not though..

And umm can u add these:

//Lunar Isles
BankTiles[19] := [Point(2099, 3920)]; //<----- This tile is the one right infront of bird's eye jack or whatever his name is.. because the others require that necklaces.
//Alkharid BankChest
BankTiles[21] := [Point(3308, 3120)];

begin
if not R_WaitUpTextMulti(['Bank chest', 'Shantay chest'], 500)then
its shantay chest not bank chest for alkharid.. as for my next question, umm when banking, if you don't switch tabs yourself, the debug says something like: Item Not found in bank.. even though the item is in the bank..

lets say I have an item in the first bank tab, and my current tab is tab 7 (just an example).. and I do R_WithdrawItem(bleh, false); it will withdraw the first item of tab 7 instead of switching tabs then withdrawing.. it does this every single time..

Another thing is that if I have an item in the first tab and my current tab is the first tab.. if the item isn't on screen and it has to scroll to index, it will sometimes try to withdraw the item even though only a little piece of it is showing thus making it sometimes withdraw the wrong item. It also sometimes withdraws the wrong item while scrolling. it needs to stop first, wait a second till the item is on screen and then withdraw. No amount of wait time I put stopped these bugs from happening.. I tried doing:

wait(RandomRange(2000, 2500));
R_WithdrawItem(meh, false);
wait(RandomRange(2000,2500));
and I still had the withdrawing problem.. its something to do with scrolling to index.

Drakan

2011-08-22 20:09:27

Allright i'll get to the bank bugs when I can. I guess the problem is I'm developing on a super high-end computer with low latency high speed internet and not counting for any lag or things of the sort from anyone elses computers. From what I test it gets it 100% of the time but I guess I should add some longer waits :P