# Thread: All AnyReflectArray.Sort will ommit recurring tile renderables

1. ## All AnyReflectArray.Sort will ommit recurring tile renderables

It seems that .Sort will bug up if there are multiple entities on the same tile. This is especially on ground items and NPCs. Basically the sorted array will only return the top NPCs/objects/items of that tile, and nothing more.

Also, TReflectObject.GetAt will Reflect.Mem.FreeObjects(ckGroundList, False); before the function is even returning the array to the user, so when the user .GetID, it will crash SMART.

TReflectionGametab.Current does not work when Minigame, Zeah, Achievement Diaries, and worldswitcher is selected.

TReflectLocalPlayer.Logout does not work when the worldswitcher is selected.

TReflectionText.GetUpText may give simba an error when worlds switching or logging out as Result := Options[0] and Options[0] doesn't exist.

TReflectionSmart.GetWorld doesn't get the recommended world as the between() returns '', and the Result := IntToStr(RandomRange(1, 78)); may return a non existent world.

TReflectionChat.NpcChooseOption still doesn't work properly as it isn't checking all possible widgets for possible options.

There is no TReflectLocalPlayer.GetName.

TReflectLocalPlayer.FFlag can hang the entire script because of 'Timeout: Integer = -1' and 'Distance(Self.GetTile.X, Self.GetTile.Y, Self.GetDestination.X,
Self.GetDestination.Y) > TileDist' always return true in some cases making the map walking procedures possibly haulting the entire script.

There is no findJava() for TReflectionSmart.Create if 'java.exe' or 'javaw.exe' fails.

There is no way for user input for a user agent for SMART.

And finally, there is no child widget IDs in Globals.smart as they are found in where ever they are used. For example; LogoutWidget.GetWidget(Widget_Logout_Container, 6); is found at TReflectLocalPlayer.Logout;

Most of these I have already semi-fixed in my functions but they should really be in the include for everyone.
@Kyle; If I were to implement these fixes and changes, would you consider merging the changes?

2. Originally Posted by ineedbot
...
OK cool, good reports. Yeah if you want to submit a pull request for them I will merge it. Just make sure the standards match the includes standards. If not, after I get done with exams in a week or so I'll take a look at them

3. Originally Posted by Kyle
OK cool, good reports. Yeah if you want to submit a pull request for them I will merge it. Just make sure the standards match the includes standards. If not, after I get done with exams in a week or so I'll take a look at them
@Kyle;

I finally did something: https://github.com/KyleHunter/OSR-Reflection/pull/105

This is what I did (I think everything I did is documented here...)
Code:
[Reflection Update # 26]
Adds some depositbox functions and procedures to Bank.Simba and improvements
Adds extra optional arguments to TReflectObjectArray.GetAll, TReflectInvItemArray.GetAll and TReflectionTiles.inPolygon

[Fixes]
Fixes TReflectLocalPlayer.SetRun to work when orbs is disabled
Fixes Reflect.Text.GetUpText possible access violation
Fixes Reflect.Smart.GetWorld to get a better world
Fixes Reflect.Chat.NpcChooseOption to choose an option
Fixes TReflectLocalPlayer.FFlag where it might hault entire script
Fixes TReflectObject.GetAt where cache would be free'd before exiting the proc
Fixes TReflectGameTab.Current to work with all tabs
Fixes TReflectLocalPlayer.Logout to work when world switcher is selected

[Changes]
Changes all .Find and .Get and .Count functions to work with variant arrays
Changes World to SmartWorld
Changes TReflectWornEquipment to be more consitant with other item types
Various house keeping with Globals.Simba and GetIndex, GetSlot

[ToDo]
Fix TReflectAnyArray.Sort ommitting recurring tile renderables
Fix TReflectionTiles.inPolygon not including end tiles
Update all definitions
Fix TReflectionChat.GetChatIndices
Add TReflectionBank deposit box functions to deposit items
Possibly add break handler and randoms handler
[End]
I kept to the include's standards and tried to make my code blend as much as possible.

4. Originally Posted by ineedbot
@Kyle;

I finally did something: https://github.com/KyleHunter/OSR-Reflection/pull/105

This is what I did (I think everything I did is documented here...)
Code:
[Reflection Update # 26]
Adds some depositbox functions and procedures to Bank.Simba and improvements
Adds extra optional arguments to TReflectObjectArray.GetAll, TReflectInvItemArray.GetAll and TReflectionTiles.inPolygon

[Fixes]
Fixes TReflectLocalPlayer.SetRun to work when orbs is disabled
Fixes Reflect.Text.GetUpText possible access violation
Fixes Reflect.Smart.GetWorld to get a better world
Fixes Reflect.Chat.NpcChooseOption to choose an option
Fixes TReflectLocalPlayer.FFlag where it might hault entire script
Fixes TReflectObject.GetAt where cache would be free'd before exiting the proc
Fixes TReflectGameTab.Current to work with all tabs
Fixes TReflectLocalPlayer.Logout to work when world switcher is selected

[Changes]
Changes all .Find and .Get and .Count functions to work with variant arrays
Changes World to SmartWorld
Changes TReflectWornEquipment to be more consitant with other item types
Various house keeping with Globals.Simba and GetIndex, GetSlot

[ToDo]
Fix TReflectAnyArray.Sort ommitting recurring tile renderables
Fix TReflectionTiles.inPolygon not including end tiles
Update all definitions
Fix TReflectionChat.GetChatIndices
Add TReflectionBank deposit box functions to deposit items
Possibly add break handler and randoms handler
[End]
I kept to the include's standards and tried to make my code blend as much as possible.
Some of the funcs are camelCase not PascalCase

5. Originally Posted by ineedbot
@Kyle;

I finally did something: https://github.com/KyleHunter/OSR-Reflection/pull/105

This is what I did (I think everything I did is documented here...)
Code:
[Reflection Update # 26]
Adds some depositbox functions and procedures to Bank.Simba and improvements
Adds extra optional arguments to TReflectObjectArray.GetAll, TReflectInvItemArray.GetAll and TReflectionTiles.inPolygon

[Fixes]
Fixes TReflectLocalPlayer.SetRun to work when orbs is disabled
Fixes Reflect.Text.GetUpText possible access violation
Fixes Reflect.Smart.GetWorld to get a better world
Fixes Reflect.Chat.NpcChooseOption to choose an option
Fixes TReflectLocalPlayer.FFlag where it might hault entire script
Fixes TReflectObject.GetAt where cache would be free'd before exiting the proc
Fixes TReflectGameTab.Current to work with all tabs
Fixes TReflectLocalPlayer.Logout to work when world switcher is selected

[Changes]
Changes all .Find and .Get and .Count functions to work with variant arrays
Changes World to SmartWorld
Changes TReflectWornEquipment to be more consitant with other item types
Various house keeping with Globals.Simba and GetIndex, GetSlot

[ToDo]
Fix TReflectAnyArray.Sort ommitting recurring tile renderables
Fix TReflectionTiles.inPolygon not including end tiles
Update all definitions
Fix TReflectionChat.GetChatIndices
Add TReflectionBank deposit box functions to deposit items
Possibly add break handler and randoms handler
[End]
I kept to the include's standards and tried to make my code blend as much as possible.
Wow man, you really outdid yourself! Some changes are things I always wanted to do but never got around to. Just from looking on my phone, here's some things I would like you to change. If you can, I would really really like you to have each fix as a separate commit, and one pull total. It makes it much more documented on the include and easier to revert changes, especially with such a massive change. I like how you added the ".Get"s take a variant, but it will break current scripts. Make a second function just take a name/id to keep compatibility. Also, don't name the param "V", make it something the scriptwriter knows what it is. On the objects get/find you moved the order of the parameters around, that will also break scripts.

From a quick look, that's what stuck out to me. Definitely try to remove the pull, and redo it will separate commits and I'll go through and comment on anything I see. But definitely nice work, some really good stuff in the!
Oh and to Harriers point, there is a couple lines of camelCase, but overall with a change this big, it looks good to me.