TextItemSetText: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| m (→Example) | No edit summary | ||
| Line 1: | Line 1: | ||
| __NOTOC__   | __NOTOC__   | ||
| Overwrites a previously created text item with the specified text. | |||
| ==Syntax==   | ==Syntax==   | ||
| Line 11: | Line 11: | ||
| ==Example==   | ==Example==   | ||
| Here, it is being used to update a scoreboard: | Here, it is being used to update a scoreboard: | ||
| <syntaxhighlight lang="lua">addEventHandler ( "onPlayerWasted",  | <syntaxhighlight lang="lua">addEventHandler ( "onPlayerWasted", getRootElement(), "onPlayerWasted") | ||
| function onPlayerWasted ( ammo, killer, weapon ) | function onPlayerWasted ( ammo, killer, weapon ) | ||
| 		if ( killer ~= false) then --Checks to see if anything killed the player. This can be false but it never equals true. | 		if ( killer ~= false) then --Checks to see if anything killed the player. This can be false but it never equals true. | ||
| Line 25: | Line 25: | ||
| ==See Also== | ==See Also== | ||
| {{Text  | {{Text functions}} | ||
Revision as of 20:09, 25 July 2007
Overwrites a previously created text item with the specified text.
Syntax
void textItemSetText ( textitem textitem, string text )
Required Arguments
- textitem: Equal to a varible of an already existing textDisplayAddText you previously specified
- text: A string that the textDisplayAddText you previously created will be changed to
Example
Here, it is being used to update a scoreboard:
addEventHandler ( "onPlayerWasted", getRootElement(), "onPlayerWasted") function onPlayerWasted ( ammo, killer, weapon ) if ( killer ~= false) then --Checks to see if anything killed the player. This can be false but it never equals true. if (players[getPlayerName(killer)].gang == "grove") then --If a player killed this person and they are part of the grove gang groveteamscore = groveteamscore + 1 --Grove gets 1 point textItemSetText ( scoregrove, tostring(groveteamscore) ) --Updated scoreboard Uses tostring() to change the varible to a string to satisfy the function. elseif (players[getPlayerName(killer)].gang == "balla") then --If a player killed this person and they are part of the balla gang ballateamscore = ballateamscore + 1 --Ballas get 1 point textItemSetText ( scoreballa, tostring(ballateamscore) ) --Updated scoreboard. Uses tostring() to change the varible to a string to satisfy the function. end end end
See Also
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText