[Include] TextDraw Streamer* - No more textdraw limits!
#1

https://www.**************/showthread.php?tid=75
Reply
#2

Neat but I doubt anyone would ever really need this to be honest.
Reply
#3

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Neat but I doubt anyone would ever really need this to be honest.
Excatly, who's even using 2048 / 256 textdraws ? Maybe a handful of them in this world. In 7 years and I never cross the limit of the 30..
Reply
#4

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Neat but I doubt anyone would ever really need this to be honest.
Quote:
Originally Posted by Hazon
Посмотреть сообщение
Excatly, who's even using 2048 / 256 textdraws ? Maybe a handful of them in this world. In 7 years and I never cross the limit of the 30..
I needed it (well, for per-player textdraws, but it felt incomplete without the global ones), which is why I created it. From what I've heard, RC-RP is also close to the limit as TommyB experimented with the predecessor of this library. Even if only a handful of people need it, I've saved them the effort of creating this themselves.
Reply
#5

That's my point maybe one or two servers will actually ever need to use this. Then you will get people using it just for the sake of using it when they don't need it. As for the effort you don't really need it anyways it isn't hard to create/delete texdraws you are going to have a function for creating them at some point how long does it take to create a delete function? A couple of minutes nothing to it.
Reply
#6

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Neat but I doubt anyone would ever really need this to be honest.
It does what many people do already with player textdraws - create and destroy them whenever needed.
With this you just have to worry about the visible limit without constantly creating and destroying player textdraws yourself, I'd argue it to be safer as well (at least it requires less effort to assure the script(s) delete all player TDs).

I have one little suggestion though - could you add an extra id?
Like (Player)TextDrawSet/GetExtraID?

That would be really neat for multiple purposes, for example lists/menus built with TextDraws. Instead of looping through the array of TextDraw IDs to find the list index for the "clickedid", you can just get the extra ID and know the index directly. Saves time and effort. This could also be used to completely avoid allocating arrays for TextDraw IDs if you add 2 extra ids (first for the type of TD, second for the index).

I have some more ideas for useful functions if you plan on expanding it, eg. toggling specific TDs for specific or all players, and toggling all TDs for specific players (seperately from showing/hiding them).

Really good include!
Reply
#7

Quote:
Originally Posted by NaS
Посмотреть сообщение
I have one little suggestion though - could you add an extra id?
Like (Player)TextDrawSet/GetExtraID?

That would be really neat for multiple purposes, for example lists/menus built with TextDraws. Instead of looping through the array of TextDraw IDs to find the list index for the "clickedid", you can just get the extra ID and know the index directly. Saves time and effort.

I have some more ideas for useful functions if you plan on expanding it, eg. toggling specific TDs for specific or all players, and toggling all TDs for specific players (seperately from showing/hiding them).
All suggestions are welcome, although I won't be updating it too soon since I'm still quite busy with school, I haven't even finished updating the GPS plugin yet. This has been on my GitHub for 2-3 months, it just didn't have a readme until now.
Reply
#8

I got a suggestion, add a grouping feature so you can hide/show groups of TD's.

Код:
PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[], group=INVALID_TD_GROUP);
PlayerText:DestroyPlayerTextDrawGroup(group);
Reply
#9

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I got a suggestion, add a grouping feature so you can hide/show groups of TD's.

Код:
PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[], group=INVALID_TD_GROUP);
PlayerText:DestroyPlayerTextDrawGroup(group);
Yeah!
Reply
#10

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I got a suggestion, add a grouping feature so you can hide/show groups of TD's.

Код:
PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[], group=INVALID_TD_GROUP);
PlayerText:DestroyPlayerTextDrawGroup(group);
Please, this would be real useful!
Reply
#11

Updated, NaS implemented extra IDs.

Code:
TextDrawSetExtraID(Text:text, extra1, extra2 = INVALID_TEXTDRAW_EXTRA_ID);
TextDrawGetExtraID(Text:text, &extra1, &extra2 = INVALID_TEXTDRAW_EXTRA_ID);

PlayerTextDrawSetExtraID(playerid, PlayerText:text, extra1, extra2 = INVALID_TEXTDRAW_EXTRA_ID);
PlayerTextDrawGetExtraID(playerid, PlayerText:text, &extra1, &extra2 = INVALID_TEXTDRAW_EXTRA_ID);
Reply
#12

Following.
Reply
#13

Quote:
Originally Posted by Y_Less
View Post
So z-indexes?
Precisely for TD's you create them with lowest priority first to highest.

@Edit one more quick note when pressing ESC should close textdraws in order highest priority to lowest.
Reply
#14

https://i.imgur.com/9BaF3CC.png

I'm at the limit nearly. I could be over the limit already, if I didn't switch onto global tds with arrays.
Reply
#15

Quote:
Originally Posted by Riddick94
View Post
https://i.imgur.com/9BaF3CC.png

I'm at the limit nearly. I could be over the limit already, if I didn't switch onto global tds with arrays.
I can almost guarantee you are using TD's incorrectly then. You must have a shit load of player td's that should actually be global. 100 global and 235 player I know that is fucked up just by looking at it.

@Edit
Some more gripes with this include.

- Instead of arbitrarily just shoving textdraws into the streamer let the user choose if the td will actually be streamed or not! I thought about this quite a bit it makes absolutely no sense to have to stream ALL textdraws why would you? It makes sense that only lower priority less used systems would need to be streamed.

- This ties into the first point. How many textdraw slots or player textdraw slots do you really need for effective streaming? Certainly not all of them! That would be a shit load of extra overhead for nothing. Destroying/Creating is a slow process when it comes to updating clients with newly created TD's.

- Stuff like extra id's would still be beneficial so even if TD's are not streamed this system goes beyond being just a streamer but capable of handling native functions in a powerful sub-system controller.

- Features like grouping and as Y_Less pointed out the correct term z-indexes extends functionality to the makings of a GUI controller.
Reply
#16

Quote:
Originally Posted by Pottus
View Post
I can almost guarantee you are using TD's incorrectly then. You must have a shit load of player td's that should actually be global. 100 global and 235 player I know that is fucked up just by looking at it.

[...]
You could have said that back a year ago, but not when I have decided to work on it from scratch again last year January, doing it all logically.

Older version of my gamemode, was using only PlayerTextDraws and I had an issue with the limits but, right now it's been worked enough without allowing me compressing it anymore or at least not that much.

TLoU (SA-MP) uses a lot of textdraws..

Global is about ~1000 lines (for loops)
https://i.imgur.com/DlkQGBC.png

Per-Player are about 1300 lines (not a lot of lines because most of them are in for-loops)
https://i.imgur.com/01kV8L3.png
Reply
#17

I can't tell anything with that, if I saw the code I would know if there was anything that could be better. I wouldn't worry about people seeing your code either it is the lamest thing to worry about.
Reply
#18

Very good!
Reply
#19

Quote:
Originally Posted by Riddick94
View Post
You could have said that back a year ago, but not when I have decided to work on it from scratch again last year January, doing it all logically.

Older version of my gamemode, was using only PlayerTextDraws and I had an issue with the limits but, right now it's been worked enough without allowing me compressing it anymore or at least not that much.

TLoU (SA-MP) uses a lot of textdraws..

Global is about ~1000 lines (for loops)
https://i.imgur.com/DlkQGBC.png

Per-Player are about 1300 lines (not a lot of lines because most of them are in for-loops)
https://i.imgur.com/01kV8L3.png
Stupid question:

What's the point on hiding textdraw codes?
Reply
#20

Quote:
Originally Posted by SymonClash
View Post
Stupid question:

What's the point on hiding textdraw codes?
Stupid answer:

This is not hiding, this is showing the quantity.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)