short m ; declare an integer set m to (VariableScript.Wage/4); set m to Wage and divide it by 4 player.additem Gold001 m ; add the <Wage> amount of gold to the player set VariableScript.Wage to 0 ; reset the Wage variable to zero
This code works as expected when placed in a Quest Script, which uses Begin MenuMode or Begin GameMode. I would use this only there is a significant delay in waiting for the Wage to be paid (up to 5 seconds).
I would prefer the Resulting Script box to actually carry out the calculation and add the gold at the end of the dialogue. I know that it's possible to run a resulting script, but what am I doing wrong here?