#TEXTDRAW SIMPLE CLICK

31 messages · Page 1 of 1 (latest)

fathom ridge
#

The purpose of this include is to simplify the creation of interactions with textdraws in SAMP. However, I had an unexpected result with this include as the responsiveness greatly improved. Now the click is extremely faster and smoother. If you encounter any problems, please report them to me privately, and I will fix or help. Thanks ♥️

Repository: https://github.com/devbluen/textdraw-simple-click

GitHub

This include shortens and simplifies the creation of actions for textdraws. It also reduces response time. - devbluen/textdraw-simple-click

true elbow
#

mclovin

grim badge
#

You want to tell me your usage of hooks and als in the include is 200% faster than my usage of hooks

fathom ridge
grim badge
#

I’m afraid it was the code you were running if you encountered such performance issues mate
You should measure the speed difference and post the results with the test you made
I have strong doubts about those claims

Btw max symbol name has been increased in the 3.10.11 compiler to 63

fathom ridge
# grim badge I’m afraid it was the code you were running if you encountered such performance ...

You can indeed run the tests on your own project and see for yourself. The response time can be observed with the naked eye. However, as soon as I have some free time, I will provide a metric in the repository, which I believe is valid.

Regarding the callback, open-mp does have a higher limit, but we must remember that there are still people using the native version. By default, it is advisable to set it to 32 to avoid issues. However, since the code is open-source, you can change it to the limit you desire.

grim badge
#

How can a hook in your include which executes CallLocalFunction be faster than a bare script hooking the same callback and running the code directly

Your end users should never be told to edit the include themselves, unless they want to contribute by making a PR

fathom ridge
# grim badge How can a hook in your include which executes CallLocalFunction be faster than a...

Y_hooks is nothing more than, simply put, a loop going through multiple callbacks. OnPlayerClickPlayerTextDraw in the hook will go through several if statements until it finds your result, the same goes for ALS.

However, the created include will not go through this process of searching for the result; it will go directly to where you want. CallLocalRemoteFunction will call only one callback, and all your click logic will be within it. Yes, the include has a hook, but if you look closely at the code, it is called only once and is blocked from continuing if the specific textdraw has a registered interaction (click).

Regarding the callback length, as I mentioned before, not everyone feels confident using open-mp and prefer to stick with the native one. However, if someone happens to be using it and feels the need to use more than 30 characters in a callback, they can simply go to the include and increase the limit. Although I don’t believe this will occur, it is possible. 😊

grim badge
#

Ok my talking here is a bit pointless I see
Just mention me once you measure the performance gains 👍

fathom ridge
dense escarp
#

This trades memory for processing a repetition structure when used in slots in an inventory for example, so I see a performance advantage on that side, but I've already made better inventories with global textdraws which is not supported by the include and was also made to those who like the easyDialog style, which is not my case because I like y_inline, although they are easy cases to solve.

As the use of the PlayerTextDrawSetClick function is optional, it may be that whoever uses it has other clickable textdraws without using this function, and if this is true, the include is break the OnPlayerClickPlayerTextDraw hook chain with ~1 which can harm whoever is using include. cpp if (!e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_VALIDA]) return Y_HOOKS_CONTINUE_RETURN_1; // Or 1

fathom ridge
worthy dagger
fathom ridge
worthy dagger
#

u gonna keep developing this include or just hand it over to the community to update themselves? And is it alright if they go ahead and tweak it or make changes?

fathom ridge
grim badge
fathom ridge
grim badge
#

Ok, enlighten everyone how did you figure your include makes things so fast if you haven’t benchmarked a single thing

worthy dagger
fathom ridge
worthy dagger
grim badge
civic nebula
#

🍿

dense escarp
fathom ridge
# dense escarp Its a really strong quote and only with `GetTickCount` would not show this diffe...

The idea is really this, to simplify clicks as the include's name suggests. However, in my project, which is indeed quite large and with many layouts, I noticed a significant difference in response times because it doesn't need to go through all the checks before reaching my click target.

However, it is a versatile include and can be adapted to other things and tools, such as the PawnPlus you mentioned. In a Brazilian development community, they compared the system to easyDialog for its practicality and the cleanliness of the resulting code.

fathom ridge
# civic nebula https://github.com/guil2k7/samp-textdraw-streamer

As I mentioned, anyone can take over the project and create other directions like plugins or enhance existing plugins with the idea of the include as undefined did. It turned out really well even though I don't use the textdraw-streamer, I know its adaptation was good.