Ui::getTextSubstringSafe: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
No edit summary
 
Line 16: Line 16:
{{Ui_s_function_c}}
{{Ui_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:UI API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 14:57, 20 May 2017

Returns a substring of a specified length starting at a specified position. The result is guaranteed not to exceed the specified max length.

NOTE: The 'maxLength' parameter might actually be the size of the buffer that is returned. More research is needed. -CL69

Example:
// Condensed example of how Rockstar uses this function
strLen = UI::GET_LENGTH_OF_LITERAL_STRING(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT());
subStr = UI::_GET_TEXT_SUBSTRING_SAFE(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT(), 0, strLen, 63);

--

'fm_race_creator.ysc', line 85115:
// parameters modified for clarity
BOOL sub_8e5aa(char *text, int length) {
for (i = 0; i <= (length - 2); i += 1) {
if (!GAMEPLAY::ARE_STRINGS_EQUAL(UI::_GET_TEXT_SUBSTRING_SAFE(text, i, i + 1, 1), ' ')) {
return FALSE;
}
}
return TRUE;
}

Syntax

mp.game.ui.getTextSubstringSafe(text, position, length, maxLength);

Required Arguments

  • text: String
  • position: int
  • length: int
  • maxLength: int

Return value

  • String

Example

// todo

See also