Dialogue - Result Script

Post » Mon Aug 24, 2009 1:30 am

I have the follwoing code in the Result Script box for a certain piece of dialogue.
		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?
User avatar
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Sun Aug 23, 2009 6:37 pm

Not sure on this one, try and place it last. not first. You could try to make the last line give you the GOLD001
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Sun Aug 23, 2009 4:31 pm

I have the follwoing code in the Result Script box for a certain piece of dialogue.
		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?

I'm not sure, but I think the problem is "short m", i.e. the declaration. Try changing your script to:
	set VariableScript.Wage to (VariableScript.Wage/4);divide Wage by 4									player.additem Gold001 VariableScript.Wage; add the <Wage> amount of gold to the player							set VariableScript.Wage to 0; reset the Wage variable to zero


For the record, here's my barterBuy/barterSell result script which works well:
set tnoEEM.merchant_gold to tnoEEM.merchant_gold + tnoEE.gaCurrentGold - player.GetItemCount Gold001SetBarterGold tnoEEM.merchant_goldset tnoEEM.barter_update to 1

User avatar
victoria johnstone
 
Posts: 3424
Joined: Sat Oct 14, 2006 9:56 am

Post » Sun Aug 23, 2009 8:46 pm

The following code worked:
set VariableScript.Wage to (VariableScript.Wage*0.25)player.additem Gold001 VariableScript.Wageset VariableScript.Wage to 0


Good call NiceOne.
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Mon Aug 24, 2009 12:36 am

This may be redundant at this point, but I wanted to clarify that the reason it didn't work is that you're allowed to declare variables in a resultscript.
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Sun Aug 23, 2009 12:53 pm

This may be redundant at this point, but I wanted to clarify that the reason it didn't work is that you're allowed to declare variables in a resultscript.

You mean you are NOT allowed to declare variables in result scripts?
User avatar
Jennie Skeletons
 
Posts: 3452
Joined: Wed Jun 21, 2006 8:21 am


Return to IV - Oblivion