Coder Social home page Coder Social logo

Get_Text about ysi-includes HOT 26 CLOSED

pawn-lang avatar pawn-lang commented on June 11, 2024
Get_Text

from ysi-includes.

Comments (26)

Misiur avatar Misiur commented on June 11, 2024 2

I've added Text_Format. Closed by #200

from ysi-includes.

m0k1 avatar m0k1 commented on June 11, 2024

https://github.com/Misiur/YSI-Includes/blob/YSI.tl/YSI_Players/y_text.inc#L105 ? There is ...

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

https://github.com/Misiur/YSI-Includes/blob/YSI.tl/YSI_Players/y_text/impl.inc#L1051-L1118

Not a very good search, but also not a very good result since the code doesn't actually return the text directly (see the comments). Also doesn't take the $NAME syntax, so I would suggest wrapping it with something LIKE BUT NOT EXACTLY:

#define Text_Get(%0,%1) _Text_Get(%0,DO_TEXT_SET:%1 UNDO_MOVE|||)

stock _Text_Get(playerid, search[], ident[])
{
    YSI_g_sReturnText = "";
    if (!IsPlayerConnected(playerid)) return YSI_g_sReturnText;
    Text_GetText(search, ident, Langs_GetPlayerLanguage(playerid));
    return YSI_g_sReturnText;
}

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

Magic? Before this issue I use the github search for Text_GetText and it doesn't show anything else except the comment from your link... Now it show the function here it is magic? o.O

Nevermind, it still show error:

error 017: undefined symbol "Text_GetText"
Text_GetText("all", "MSG_TEST", GetPlayerLanguage(playerid));

Oh, maybe I looked for Text_GetPlayerText

Update: Thanks for your comment Y_Less I will test something

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

I test this code @Y-Less and nothing, so I define _debug 7 and this is in log

[00:21:42] Text_GetText: loop1 � 0 -1 � 3
[00:21:42] Text_GetText: loop1 � 0 -1 � 3
[00:21:42] Text_GetText: loop1 � 0 -1 � 3
[00:21:42] Text_GetText: loop1 � 0 -1 � 3
[00:21:42] Text_GetText: loop1 � 0 -1 � 3
[00:21:42] Text_GetText: loop1 � 0 -1 � 3

(a lot of... -> infinite loop)

Any ideas why it show this?

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

Tested what? The code I explicitly said not to use?

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

yes, I just want a test it

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

@Y-Less I find something interesting. function Text_DebugAllText doesn't print nothing for me. I detect it's because YSI_g_sUnusedSlot is empty (value=0). But text is loaded and it work.

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

Something being zero doesn't mean it is empty, it just means the value is zero. IIRC that would have to be -1 to be unused, whereas it is actually a pointer to the first unused slot in a linked list - very y_iterate like, but independent code (it should be unified, and I was doing a major rewrite of y_text, but never finished). I'm also not entirely sure how you got an infinate loop with the other code while the rest of y_text that uses the same functions works...

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

I don't know too. (About YSI_g_sUnusedSlot I just ask if it's normal...)
About this missing feature I think it's really important function for real using of y_text and maybe this is one of the reasons why no one use it. (IMHO)

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

@Y-Less If you had time, could you look at it? Thanks

from ysi-includes.

Misiur avatar Misiur commented on June 11, 2024

@Y-Less: Does Text_GetText return printable string, or it has some hidden info before being passed to formatter? The more I think about this request, the more things that will go wrong appear. IIRC formatter can handle strings injected in %s for gradients and stuff, so if there's a way to fetch pure string the colours wouldn't even be parsed?

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

No, colours won't be in as not only does it not know where colours must go but it also doesn't know what the colours should look like - are they {FF00AA} or ~r~? y_text has its own representation internally that can be output as either.

from ysi-includes.

Misiur avatar Misiur commented on June 11, 2024

@PatchwerkQWER it's up to you now. I can merge that function. For simple stuff like plain format strings Some %s string it will work, but you won't leverage features such as colour gradients. You have all sorts of functions for displaying text for Players/PlayerSets/Groups, you have macros for dialogs and stuff. Could you share with use usecase for such function?

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

If you do write this, I would suggest an interface like:

Text_Get(name[], Language:lang, style);

Then you can use the last parameter to determine how the colours are resolved - but even that doesn't really cover format parameters. Maybe you should instead have a format-like function:

Text_Format(dest[], size, Language:lang, style, name[], ...);

from ysi-includes.

PatchwerkQWER avatar PatchwerkQWER commented on June 11, 2024

@Misiur I'm not sure what you want from me. I want use it just for my textdraw messages.
@Y-Less Great idea

from ysi-includes.

Jonathan-Rosewood avatar Jonathan-Rosewood commented on June 11, 2024

I can not understand what was decided in the end.
How to get "naked" (without formatting, and color) for the text of a player?
Or maybe somebody knows another solution for this task:

Text_Send(playerid, $COMMAND_HELP, YCMD:low, "send a message to player very nearby you in low In-Character chat");

I want to use a nested replacement in Text_Send function.

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

Why? That should be done with a separate string entry such as COMMAND_LOW_HELP = Send a message to player very nearby you in low In-Character chat. Formatting text like that totally defeats the object of using a language system.

from ysi-includes.

Jonathan-Rosewood avatar Jonathan-Rosewood commented on June 11, 2024

Then we have to repeat the same part ($COMMAND_HELP text) of the text in each entry.
Or have I misunderstood something?

For example now used "$COMMAND_HELP = '/%n' used for %s" and static help information per command:

YCMD:command(playerid, params[], help) {
    if(help) return Text_Send(playerid, $COMMAND_HELP, YCMD:command, "get information about the command");
    if(sscanf(params, "s[64]", params)) return Text_Send(playerid, $COMMAND_SYNTAX, YCMD:command, "<command>");
    Command_ReProcess(playerid, params, true);
    return true;
}

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

But you shouldn't HAVE static information per command. Static information isn't translated, this:

get information about the command

Is just in English. If you only want one language, there's no point using y_languages.

from ysi-includes.

Jonathan-Rosewood avatar Jonathan-Rosewood commented on June 11, 2024

I agree, but I need to translate a section of text and source code of the game mode, on the forced use y_language.
Variant using define disappears.
As I understand it, use nested texts in Text_Send is impossible?

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

If you are still working on the translation, just do it in one language for now. If the text string isn't found in one language it will fall back to another language.

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

Other than that, I'm not sure what you mean, but there is no way to nest text functions - they are pretty complex already.

from ysi-includes.

Jonathan-Rosewood avatar Jonathan-Rosewood commented on June 11, 2024

I want to use:

Text_Send(playerid, $COMMAND_HELP, YCMD:command, $HELP_COMMAND);

Where $COMMAND_HELP main help text "Command '/%n' used for " and $HELP_COMMAND "get information about the command" for all command helps & syntax.

from ysi-includes.

Y-Less avatar Y-Less commented on June 11, 2024

While that is different to what you were talking about earlier with explicit strings. This is possibly a legitimate use, but sadly can't be done at all. The only thing you can do is just write:

HELP_COMMAND = Command '/%n' used for get information about the command.

That, of course, is not very good grammar - "for" should be "to", but also demonstrates that while this method is a little more verbose, it is clearer when two phrases don't work together, and is faster to display.

from ysi-includes.

Jonathan-Rosewood avatar Jonathan-Rosewood commented on June 11, 2024

Grammar, of course, I am unfortunately not so much know English.
Thank you for the correction.

I certainly wanted to minimize the repetition of words in a file transfer, but the argument regarding the performance, I was finally persuaded.
Thank you, @Y-Less, you're beautiful!

from ysi-includes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.