Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

ClareXoBearrx3R9

Text Limitations / Truncation?

Recommended Posts

ClareXoBearrx3R9

Is there a known limitation with the amount of text that can be drawn on-screen with either the game engine or ScriptHookV?

I'm using C++ and have a 'page' of my default controls and they ALWAYS get cut off. The array I'm using is exactly 63 elements in size and ALWAYS gets cutoff at 44th element (0-basedindexing) and ends up looking like this:

Lq5MouS.jpg

The array is declared as follows:

    const char *sdefaultControls[] = {        "~y~Vehicle Snap-ins",        "------------------------",        "",        "Spawn Vehicle in Slot ~b~X~s~",        "Repair Vehicle",        "Wash Vehicle",        "Save Vehicle",        "Delete Vehicle (Mark for Deletion)",        "Upgrade Vehicle",        "Toggle Vehicle Invincibility ~g~on~s~ / ~r~off~s~",        "Toggle Vehicle Visibility ~g~on~s~ / ~r~off~s~",        "Flip Vehicle",        "Cycle through Vehicle Deployment Modes ~b~I~s~, ~b~II~s~, ~b~III~s~, ~b~IV~s~, and ~b~V~s~",        "Toggle Vehicle Engine ~g~on~s~ / ~r~off~s~",        "Paint Random Primary & Secondary Colors on Vehicle",        "Speedup"        // ... and so on.    }    

and is displayed as follows:

            #define COUNTOF(x) (sizeof(x)/sizeof(*x))            for (i = 0; i < COUNTOF(sdefaultControls); i++){                sprintf(specControls_pageDisplay, "%s", specialEditions_defaultControlCTRLSs[i]);                text = specControls_pageDisplay;                UI::SET_TEXT_FONT(4);                UI::SET_TEXT_SCALE(text_scale_controlList, text_scale_controlList);                UI::SET_TEXT_COLOUR(255, 255, 255, 255);                UI::SET_TEXT_WRAP(0.0, 1.0);                UI::SET_TEXT_CENTRE(0); // o = 1.                UI::SET_TEXT_DROPSHADOW(1, 1, 1, 1, 1); // o = all 0's.                UI::SET_TEXT_EDGE(1, 0, 0, 0, 205);                UI::_SET_TEXT_ENTRY("STRING");                UI::_ADD_TEXT_COMPONENT_STRING((char *)text.c_str());                UI::_DRAW_TEXT(text_x_2A, base_pos_plist_y_tmp[0]); // X tried:                /*                WAIT(0);                */                                /*                for (k = 0; k < 1000; k++){                    UI::DISABLE_FRONTEND_THIS_FRAME();                }                */                sprintf(specControls_pageDisplay, "%s", specialEditions_defaultControls[i]);                text = specControls_pageDisplay;                UI::SET_TEXT_FONT(4);                UI::SET_TEXT_SCALE(text_scale_controlList, text_scale_controlList);                UI::SET_TEXT_COLOUR(255, 255, 255, 255);                UI::SET_TEXT_WRAP(0.0, 1.0);                UI::SET_TEXT_CENTRE(0); // o = 1.                UI::SET_TEXT_DROPSHADOW(1, 1, 1, 1, 1); // o = all 0's.                UI::SET_TEXT_EDGE(1, 0, 0, 0, 205);                UI::_SET_TEXT_ENTRY("STRING");                UI::_ADD_TEXT_COMPONENT_STRING((char *)text.c_str());                UI::_DRAW_TEXT(text_x_2, base_pos_plist_y_tmp[0]); // X tried:                                base_pos_plist_y_tmp[0] += 0.02f; // This a float indicating the position on the y-axis (defined earlier in the code).            }

And every single time, even if I change the order of everything, it gets cutoff prematurely as you can see in the screenshot. Am I missing something? I've looked over this a billion times and I do the same thing with other pages of my mod and have no issues. The only difference is there isn't as much text.

I tested this with putting a WAIT(0) statement (as you can see in the code above), and that just made everything flicker (I expected that)-- but I did see that all the text was flashing as it was traversed in the loop. Obviously since that's not feasible, I took that out and replace it with a "meaningless" loop in the middle to see if that would help to offset when it actually displays the text, but that didn't help at all. I finally made two separate for loops, displaying half of the array at a time and even that doesn't work.

Anyone have a similar issue? :(
This isn't the first time I've had this issue (I had it once before but I thought it was something I did wrong). After looking at my code hundreds of times and there being no problem compiling, along with my testing, I'm starting to believe it's something out of my control. :( But it would be great if anyone could confirm this. :D

Edited by ClareXoBearrx3

Share this post


Link to post
Share on other sites
sjaak327

I have the exact same issue. Too many text elements drawn tot the screen at the same time will mean text disappears.

Share this post


Link to post
Share on other sites
ClareXoBearrx3R9

OK. Thanks for confirming!! :D

 

I guess it's just a limitation then on the game itself. At least it's not my code then. Oh well, I'll just use another page I guess. :)

Share this post


Link to post
Share on other sites
Skorpro

 

 

I have the exact same issue. Too many text elements drawn tot the screen at the same time will mean text disappears.

 

 

 

OK. Thanks for confirming!! :D

 

I guess it's just a limitation then on the game itself. At least it's not my code then. Oh well, I'll just use another page I guess. :)

 

If I don't understand this right (it's 6:40 a.m.) ignore my post!

 

I have no problem to display ~4200 chars (more never tested...)

yq3iannz1ctd.jpg

 

 

Example C++ Code:

/*    This is just a small TEXT-TEST... done by Skorpro*/#include "script.h"#include <string>#include <sstream>// - Vars -#define NUM_OF_LINES 45string strLines[NUM_OF_LINES];// - Funcs -void skpPrint(char *cText, float tx, float ty, int iFont, int iLiMiRe, float fFontX, float fFontY, bool bShadow){    if (iFont == 2) iFont = 4;    else if (iFont == 3) iFont = 7;    else if (iFont > 3) iFont = 0;    SET_TEXT_FONT(iFont);    SET_TEXT_COLOUR(255, 255, 255, 255);    if (bShadow) SET_TEXT_DROPSHADOW(1, 0, 0, 0, 255);    SET_TEXT_SCALE(fFontX, fFontY);    if (iLiMiRe == 0) SET_TEXT_CENTRE(0);    else if (iLiMiRe == 1) SET_TEXT_CENTRE(1);    else if (iLiMiRe == 2) SET_TEXT_RIGHT_JUSTIFY(1);    SET_TEXT_EDGE(1, 0, 0, 0, 255);    _SET_TEXT_ENTRY("STRING");    _ADD_TEXT_COMPONENT_STRING(cText);    _DRAW_TEXT(tx, ty);}void skpStrCat(int iAmountOfLines){    for (int i = 0; i < iAmountOfLines; i++)    {        ostringstream oss;        oss << i + 1;        strLines[i] += oss.str();        strLines[i] += " - 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 End";        oss.clear();    }}void skpShowLines(int iAmountOfLines){    for (int i = 0; i < iAmountOfLines; i++)    {        skpPrint((char*)strLines[i].c_str(), 0.5f, 0.01f + (float)i / 50, 3, 1, 0.5f, 0.5f, 1);    }}// - Main -void main(){    WAIT(2000);    // Don't f**k your PC    skpStrCat(NUM_OF_LINES);    while (true)    {        skpShowLines(NUM_OF_LINES);        WAIT(0);    }}void ScriptMain(){    main();}

Maybe it's useful for you guys :)

Edited by Skorpro

Share this post


Link to post
Share on other sites
ClareXoBearrx3R9

Nice!

 

I actually counted and there are (including quotations on each line) 3,510 characters in my control list alone. :p That doesn't include the title and other info I have at the top of my page either :D

 

So maybe 450-500 characters is okay but my (in total, possibly around 4,000) characters isn't. xD

Share this post


Link to post
Share on other sites
Skorpro

 

 

Nice!

 

I actually counted and there are (including quotations on each line) 3,510 characters in my control list alone. :p That doesn't include the title and other info I have at the top of my page either :D

 

So maybe 450-500 characters is okay but my (in total, possibly around 4,000) characters isn't. xD

 

Do'h ...it was my mistake :blush: With 5 lines (first test) there are 475 chars (5*95) but the last test had 45 lines -> over 4200 chars :sui:

 

Anyway! Here is a new test with 6710 chars (70 lines):

JZZpqsW.jpg

 

Replace these lines:

#define NUM_OF_LINES 70...skpPrint((char*)strLines[i].c_str(), 0.5f, 0.01f + (float)i / 100, 0, 1, 0.15f, 0.15f, 1);

I think there are enough chars now ;)

Share this post


Link to post
Share on other sites
ClareXoBearrx3R9

oh wow! That's cool! I guess I don't know what the character limit is then. Or maybe the limitation lies somewhere else :/

 

As a sidenote, I did experiment a while ago and found that the maximum length of any single string can be 98 characters, in order to properly display without getting the text cuf-off like. So for example, a string like this:

string test = "1234567890987654321234567890987654321234567890987654321234567890987654321234567890987654321234567890987654321";

Would only display the first 98 characters and would look like this:

 

1234567890987654321234567890987654321234567890987654321234567890987654321234567890987654321234567

 

Also note that the per-string character limit includes color and format codes, like "~r~", "~g~", and so on. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.