Code: Select all
if (!bUseInv) ThePlayer.SelectedItem = None;
Code: Select all
if ((ThePlayer.SelectedItem != None) && (!bUseInv)) ThePlayer.SelectedItem = None;
Code: Select all
if (!bUseInv) ThePlayer.SelectedItem = None;
Code: Select all
if ((ThePlayer.SelectedItem != None) && (!bUseInv)) ThePlayer.SelectedItem = None;
While the code is smaller, it'll always execute the EX_Let operation if bUseInv is always False.EX_JumpIfNot, (*)
Not_PreBool, [!]
EX_BoolVariable (or EX_LocalVariable)
-> (*) If condition evaluates to false, jumps beyond of the code inside the if () {...} brackets
EX_Let, [=]
EX_Context,
EX_LocalVariable,
EX_InstanceVariable,
EX_NoObject [None]
While the code is bigger, it'll always execute the NotEqual_ObjectObject operation inside a && skip... regardless of the bUseInv value.EX_JumpIfNot, (*)
AndAnd_BoolBool,
EX_Skip, (**)
NotEqual_ObjectObject, [!=]
EX_Context,
EX_LocalVariable,
EX_InstanceVariable,
EX_NoObject, [None]
-> (**) Skip may cause a jump outside of the full conditional here, followed by offset specified by EX_JumpIfNot
Not_PreBool, [!]
EX_BoolVariable (or EX_LocalVariable)
-> (**) Skip destination here if first condition fails.
-> (*) If full condition evaluates to false, due to either side of &&, jumps beyond of the code inside the if () {...} brackets
EX_Let, [=]
EX_Context,
EX_LocalVariable,
EX_InstanceVariable,
EX_NoObject [None]
Code: Select all
native final operator(10) Object =! (out Object ObjVariable, bool bClearIfFalse);
Usage:
ThePlayer.SelectedItem =! bUseInv; //The operator returns the final output as well, if you want to use it within other conditionals
Code: Select all
void UXC_CoreStatics::execEqualNot_ObjectBool( FFrame &Stack, RESULT_DECL)
{
P_GET_OBJ_REF(ObjVariable);
P_GET_BOOL(bClearIfFalse);
//P_FINISH; //Not needed because it's an operator
*(UObject**)Result = bClearIfFalse ? ObjVariable : NULL;
}
Always having 6 opcodes, regardless of the player's selected item or the bUseInv value.EX_FinalFunctionCall (because operator isn't a GNative)
execEqualNot_ObjectBool [=!]
EX_Context
EX_LocalVariable
EX_InstanceVariable
EX_BoolVariable (or EX_LocalVariable)
Code: Select all
if (!bUseInv) ThePlayer.SelectedItem = None;