TextDisplayAddObserver: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
|||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | |||
This function adds a [[player]] as an observer of a [[textdisplay]]. This allows the [[player]] to see any [[textitem]]s that the [[textdisplay]] contains. | This function adds a [[player]] as an observer of a [[textdisplay]]. This allows the [[player]] to see any [[textitem]]s that the [[textdisplay]] contains. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">void textDisplayAddObserver ( textdisplay display, player playerToAdd )</syntaxhighlight> | |||
===Required Arguments=== | ===Required Arguments=== | ||
* ''' | * '''display''': The [[textdisplay]] to add the [[player]] to as an observer. | ||
* '''playerToAdd ''': The [[player]] that should observe the [[textdisplay]]. | * '''playerToAdd''': The [[player]] that should observe the [[textdisplay]]. | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
textDisplayAddObserver ( | function MyTestTextFunction () | ||
display = textCreateDisplay () -- create a new display, store the reference in a variable called display | |||
textDisplayAddText ( | textDisplayAddObserver ( display, thePlayer ) -- add an observer to it | ||
text = textCreateTextItem ( "Hello World", 0.5, 0.5, "medium", 255, 0, 0, 255, 2, "left", "top", 255) --red text of 24pt at the center of your screen | |||
textDisplayAddText ( display, text ) -- Add the text item to the text display | |||
end | |||
</syntaxhighlight> | |||
==See Also== | |||
{{Text functions}} |
Latest revision as of 15:35, 23 June 2014
This function adds a player as an observer of a textdisplay. This allows the player to see any textitems that the textdisplay contains.
Syntax
void textDisplayAddObserver ( textdisplay display, player playerToAdd )
Required Arguments
- display: The textdisplay to add the player to as an observer.
- playerToAdd: The player that should observe the textdisplay.
Example
function MyTestTextFunction () display = textCreateDisplay () -- create a new display, store the reference in a variable called display textDisplayAddObserver ( display, thePlayer ) -- add an observer to it text = textCreateTextItem ( "Hello World", 0.5, 0.5, "medium", 255, 0, 0, 255, 2, "left", "top", 255) --red text of 24pt at the center of your screen textDisplayAddText ( display, text ) -- Add the text item to the text display end
See Also
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText