TextDisplayAddText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server function}}
This function adds a [[textitem]] to a [[textdisplay]]. This allows any observers of the [[textdisplay]] to see the [[textitem]].
This function adds a [[textitem]] to a [[textdisplay]]. This allows any observers of the [[textdisplay]] to see the [[textitem]].


==Syntax==
==Syntax==
void textDisplayAddText ( [[textitem]] itemToAdd, [[textdisplay]] displayToAddTo )
<syntaxhighlight lang="lua">
void textDisplayAddText ( textdisplay displayToAddTo, textitem itemToAdd )
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
 
* '''displayToAddTo''': The [[textdisplay]] to add the [[textitem]] to.
* '''itemToAdd''': The [[textitem]] to add to the display.
* '''itemToAdd''': The [[textitem]] to add to the display.
* '''displayToAddTo''': The [[textdisplay]] to add the [[textitem]] to.


==Example==
==Example==
textDisplay = [[textCreateDisplay]] ();
<syntaxhighlight lang="lua">
[[textDisplayAddObserver]] ( textDisplay, player );
-- Create a text display.
textItem = [[textCreateTextItem]] ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 );
myTextDisplay = textCreateDisplay ()
[[textDisplayAddText]] ( textDisplay, textItem );
-- Add a player as an observer, i.e. this player will see all text items that are on this display
textDisplayAddObserver ( myTextDisplay, aPlayer )
-- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red.
myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 )
-- Add the newly created text item to the display
textDisplayAddText ( myTextDisplay, myTextItem )
</syntaxhighlight>
 
==See Also==
{{Text functions}}

Latest revision as of 18:55, 21 August 2007

This function adds a textitem to a textdisplay. This allows any observers of the textdisplay to see the textitem.

Syntax

void textDisplayAddText ( textdisplay displayToAddTo, textitem itemToAdd )

Required Arguments

Example

-- Create a text display.
myTextDisplay = textCreateDisplay ()
-- Add a player as an observer, i.e. this player will see all text items that are on this display
textDisplayAddObserver ( myTextDisplay, aPlayer )
-- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red.
myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 )
-- Add the newly created text item to the display
textDisplayAddText ( myTextDisplay, myTextItem )

See Also