Tocolor: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 52: | Line 52: | ||
==See Also== | ==See Also== | ||
{{Client_utility_functions}} | {{Client_utility_functions}} | ||
Revision as of 12:49, 8 August 2010
This function retrieves the hex number of a specified color, useful for the dx functions.
Syntax
int tocolor ( int red, int green, int blue [, int alpha = 255] )
Required Arguments
- red: The amount of red in the color (0-255).
- green: The amount of green in the color (0-255).
- blue: The amount of blue in the color (0-255).
Optional Arguments
- alpha: The amount of alpha in the color (0-255).
Returns
Returns a single value representing the color.
Example
This example displays the text "Tuna" in small at the top left side of your screen. The color of this text can be changed using a command.
-- Make some default colour R = 255 G = 255 B = 255 A = 255 -- This function draws the text, and the color is decided with tocolor(R, G, B, A) function drawDX() dxDrawText("Tuna", 10, 10, 100, 100, tocolor(R, G, B, A), 1) end addEventHandler("onClientRender", root, drawDX) -- This will make some DX text (Tuna) appear at the top left of your screen. --Now to modify the R, G, B, and A with a command. function editRGBA(command, red, green, blue, alpha) if (tonumber(red) and tonumber(green) and tonumber(blue) and tonumber(alpha)) then -- Make sure the user entered all 4 args as numbers. R = tonumber(red) G = tonumber(green) B = tonumber(blue) A = tonumber(alpha) -- tonumber() had to be used here else tocolor() didn't display the right color. outputChatBox("Color of Tuna set to the color of this text, with "..A.." alpha.", R, G, B) end end addCommandHandler("setcoloroftuna", editRGBA) -- setcoloroftuna command. -- Example /setcoloroftuna 255 0 0 255 - for red.
See Also
- createTrayNotification
- downloadFile
- getDevelopmentMode
- getKeyboardLayout
- getLocalization
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- setClipboard
- setDevelopmentMode
- setTransferBoxVisible
- setWindowFlashing
- showCol
- showSound
- Shared
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace