There is no spoon
Difference between revisions of "User:00zX/UScriptIt (UDK)"
From Unreal Wiki, The Unreal Engine Documentation Site
(Automatic Casts: Example of macro usage we need our auto-caster to go in first before the macros are parsed, some might require afterwards so we end up doing a 2 stage compile.) |
m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
===UScriptIt=== | ===UScriptIt=== | ||
Example of macro usage we need our auto-caster to go in first before the macros are parsed, some might require afterwards so we end up doing a 2 stage compile. | Example of macro usage we need our auto-caster to go in first before the macros are parsed, some might require afterwards so we end up doing a 2 stage compile. | ||
+ | ====Shortening Locals==== | ||
+ | <uscript> | ||
+ | `define l local | ||
+ | `define lb `{l} bool | ||
+ | `define lf `{l} float | ||
+ | `define ls `{l} string | ||
+ | |||
+ | `define elif else if | ||
+ | </uscript> | ||
+ | =====Iterators===== | ||
+ | <uscript> | ||
+ | `define i index | ||
+ | `define j ondex | ||
+ | `define li `{l} int `{i} | ||
+ | `define lj `{l} int `{j} | ||
+ | </uscript> | ||
====Automatic casts==== | ====Automatic casts==== | ||
− | ===== | + | =====Set/Check/Return===== |
+ | ======Macro====== | ||
<uscript> | <uscript> | ||
`define CheckRet(Obj) if(`Obj == none) return | `define CheckRet(Obj) if(`Obj == none) return | ||
Line 8: | Line 25: | ||
`define SetVar(Obj, Var) `{Obj}.`{Var} = `{Var} | `define SetVar(Obj, Var) `{Obj}.`{Var} = `{Var} | ||
</uscript> | </uscript> | ||
− | =====Usage===== | + | ======Usage====== |
<uscript> | <uscript> | ||
`SetVar(`P, CustomGravityScaling); | `SetVar(`P, CustomGravityScaling); | ||
Line 21: | Line 38: | ||
`SetVar(`MProj()_`{P}(`{P}), bCanWalldodge); | `SetVar(`MProj()_`{P}(`{P}), bCanWalldodge); | ||
</uscript> | </uscript> | ||
− | =====Output===== | + | ======Output====== |
<uscript> | <uscript> | ||
Pawn.CustomGravityScaling = CustomGravityScaling; | Pawn.CustomGravityScaling = CustomGravityScaling; | ||
Line 33: | Line 50: | ||
Plugin_Pawn(Pawn).bCanDodge = bCanDodge; | Plugin_Pawn(Pawn).bCanDodge = bCanDodge; | ||
Plugin_Pawn(Pawn).bCanWalldodge = bCanWalldodge; | Plugin_Pawn(Pawn).bCanWalldodge = bCanWalldodge; | ||
+ | </uscript> | ||
+ | =====Iterators===== | ||
+ | ======Macro====== | ||
+ | <uscript> | ||
+ | `define fore(this, tmpv) foreach `{this}(`{tmpv}) | ||
+ | `define ifind(Ar) `{i} = `Ar.find('`n', `ac) | ||
+ | </uscript> | ||
+ | ======Usage====== | ||
+ | ======Output====== | ||
+ | |||
+ | |||
+ | ===Links=== | ||
+ | http://forums.epicgames.com/threads/809064-UScriptIt-Generator-Parser |
Latest revision as of 04:57, 6 March 2012
Contents
UScriptIt
Example of macro usage we need our auto-caster to go in first before the macros are parsed, some might require afterwards so we end up doing a 2 stage compile.
Shortening Locals
`define l local `define lb `{l} bool `define lf `{l} float `define ls `{l} string `define elif else if
Iterators
`define i index `define j ondex `define li `{l} int `{i} `define lj `{l} int `{j}
Automatic casts
Set/Check/Return
Macro
`define CheckRet(Obj) if(`Obj == none) return `define SetToDefault(Obj, Var) `{Obj}.`{Var} = `{Obj}.Default.`{Var} `define SetVar(Obj, Var) `{Obj}.`{Var} = `{Var}
Usage
`SetVar(`P, CustomGravityScaling); `P.MaxDoubleJumpHeight = 110; //87.0 `P.DoubleJumpThreshold = 200.0; //160.0 `P.FallSpeedThreshold = 150.0; //125.0 /** */ `CheckRet(`MProj()_`{P}(`{P})); `SetVar(`MProj()_`{P}(`{P}), bCanDodge); `SetVar(`MProj()_`{P}(`{P}), bCanWalldodge);
Output
Pawn.CustomGravityScaling = CustomGravityScaling; Pawn.MaxDoubleJumpHeight = 110; //87.0 Pawn.DoubleJumpThreshold = 200.0; //160.0 Pawn.FallSpeedThreshold = 150.0; //125.0 /** */ if(Plugin_Pawn(Pawn)== none) return; Plugin_Pawn(Pawn).bCanDodge = bCanDodge; Plugin_Pawn(Pawn).bCanWalldodge = bCanWalldodge;
Iterators
Macro
`define fore(this, tmpv) foreach `{this}(`{tmpv}) `define ifind(Ar) `{i} = `Ar.find('`n', `ac)
Usage
Output
Links
http://forums.epicgames.com/threads/809064-UScriptIt-Generator-Parser