Worklog for Zakk
Pocket Functions
Return to Worklogs
| ||
HexColor is like SetColor, but takes a single hex value instead of
three seperate Int's (this is the sort of thing that would work GREAT
with function overloading).'============================= 'HexColor and Color Constants '============================= Const COL_BLACK:Int = $, COL_WHITE:Int=1 Const COL_RED:Int = $FF0000, COL_GREEN:Int = $00FF00, COL_BLUE:Int = $0000FF Const COL_YELLOW:Int = $FFFF00, COL_MAGENTA:Int = $FF00FF, COL_CYAN:Int = $00FFFF '============================= Function HexColor(rgb:Int) Local r:Int = (rgb Shr 16) & $FF Local g:Int = (rgb Shr 8 ) & $FF Local b:Int = (rgb ) & $FF SetColor r, g, b End Function '============================= -------------------- <XtiaeN>: i wear my rollerblades while i hack games, for quick getaways |
| ||
Xor is a logic function missing in Bmax. TrueFalse() is mostly for debug purposes. '============================= Function Xor:Int(a:Int, b:Int) Return (a Or b)And Not(a And b) End Function '============================= Function TrueFalse:String(a:Int) If a = True Then Return "True" Return "False" End Function '============================= -------------------- <XtiaeN>: i wear my rollerblades while i hack games, for quick getaways |
| ||
These are pretty self-explanatory'============================= Function MinMax:Float(min_v:Float Var, max_v:Float Var, v1:Float, v2:Float) min_v=Min(v1, v2) max_v=Max(v1, v2) End Function '============================= Function Swap(v1:Float Var, v2:Float Var) Local temp:Float = v1 v1 = v1 v2 = temp End Function '============================= -------------------- <XtiaeN>: i wear my rollerblades while i hack games, for quick getaways |
| ||
This function lets you do multiple Replace()'s with just one function call :)'============================= 'Replace2 - can either replace a set of substrings with the corresponding replacements (if sub.length = with.length) ' or can replace a set of substrings with the SAME replacement (if sub.length <> with.length, only with[0] is considered) '============================= Function Replace2:String(str:String, sub:String[], with:String[] ) Local n:Int If sub.length = with.length For n = 0 To sub.length-1 str = Replace(str, sub[n], with[n]) Next Else For n = 0 To sub.length-1 str = Replace(str, sub[n], with[0]) Next EndIf Return str End Function '============================= -------------------- <XtiaeN>: i wear my rollerblades while i hack games, for quick getaways |
| ||
'============================= 'Rad - converts degrees to radians 'Deg - converts radians to degrees '============================= Function Rad:Float(degrees:Float) Return degrees*(2*Pi)/360 End Function '============================= Function Deg:Float(radians:Float) Return radians*360/(2*Pi) End Function '============================= -------------------- <XtiaeN>: i wear my rollerblades while i hack games, for quick getaways |