MADD Leveler Report Script Error

Post » Fri May 13, 2011 4:50 am

Good morning!

I've got a weird (and mostly consistent) problem with the Madd Leveler program. For a reason I haven't quite figured out yet, this script doesn't work correctly.

Begin Madd_Leveler_StatReport	Short State	if ( menumode == 1 )		return	endif	If ( State == 0 )		MessageBox "Base Stats(test): Strength %.0f, Agility %.0f, Endurance %.0f, Intelligence %.0f, Willpower %.0f, Personality %.0f, Speed %.0f, Luck %.0f.", Base_Strength, Base_Agility, Base_Endurance, Base_Intelligence, Base_Willpower, Base_Personality, Base_Speed, Base_Luck, "Ok"		Set State To 1		Return	ElseIf ( State == 1 )		MessageBox "Base Combat Skills: Armorer %.0f, Athletics %.0f, Axe %.0f, Block %.0f, Blunt Weapon %.0f, Heavy Armor %.0f, Long Blade %.0f,  Medium Armor %.0f, Spear %.0f.", Base_Armorer, Base_Athletics, Base_Axe, Base_Block, Base_BluntWeapon, Base_HeavyArmor, Base_LongBlade, Base_MediumArmor, Base_Spear, "Ok"		Set State To 2		Return	ElseIf ( State == 2 )		MessageBox "Base Combat Skills: Armorer %.0f, Athletics %.0f, Axe %.0f, Block %.0f, Blunt Weapon %.0f, Heavy Armor %.0f, Long Blade %.0f,  Medium Armor %.0f, Spear %.0f.", Base_Armorer, Base_Athletics, Base_Axe, Base_Block, Base_BluntWeapon, Base_HeavyArmor, Base_LongBlade, Base_MediumArmor, Base_Spear, "Ok"		Set State To 3		Return	ElseIf ( State == 3 )		MessageBox "Base Stealth Skills: Acrobatics %.0f, Hand-To-Hand %.0f, Light Armor %.0f, Marksman %.0f, Mercantile %.0f, Security %.0f, Short Blade %.0f, Sneak %.0f, Speechcraft %.0f.", Base_Acrobatics, Base_HandToHand, Base_LightArmor, Base_Marksman, Base_Mercantile, Base_Security, Base_ShortBlade, Base_Sneak, Base_Speechcraft, "Ok"		Set State To 0	Else		Set State To 0		Return	EndIf	StopScript Madd_Leveler_StatReportEnd


What happens is the first (Stats) box pops, then it SKIPS the Combat Skills box, and SOMETIMES skips the Stealth Skills box. Looking at the code makes me think it's because the State variable isn't getting set/updated properly, but if that's the case:

- What could be causing that?
- Is there anything I can do about that, or, alternatively, is there a way to re-write this script to make it perform more reliably?

I'm going to take a look at MWSFD and see if I can figure anything out myself, but I am NOT an expert coder/programmer by any stretch, and may easily be missing something simple and obvious. Any suggestions are appreciated.

Rochndil, who is tech writer, not a programmer...
User avatar
mollypop
 
Posts: 3420
Joined: Fri Jan 05, 2007 1:47 am

Post » Fri May 13, 2011 12:22 pm

Try putting each if statement in it's own if block, i.e.:

if ( State == 0 )    messagebox ...    set state to 1    returnendifif ( state == 1 )    messagebox ...    set state to 2    returnendifetc.

There's a redundant Base Combat Skills block - remove that. And get rid of the last else statement that sets state to 0 - shouldn't be needed when putting each state to its own if block.
User avatar
claire ley
 
Posts: 3454
Joined: Fri Aug 04, 2006 7:48 pm

Post » Fri May 13, 2011 1:44 pm

Ack!

I forgot I'd already been dinking with this version, I tried replacing the magic skills box with the combat skills box (as can be seen) to try and sort out the problem. Thanks for the suggestions, Tetchy, I'll definitely give them a try.

Rochndil, who also has an added "test" in there to make sure the script compiled...

Try putting each if statement in it's own if block, i.e.:

if ( State == 0 )    messagebox ...    set state to 1    returnendifif ( state == 1 )    messagebox ...    set state to 2    returnendifetc.

There's a redundant Base Combat Skills block - remove that. And get rid of the last else statement that sets state to 0 - shouldn't be needed when putting each state to its own if block.

User avatar
Amiee Kent
 
Posts: 3447
Joined: Thu Jun 15, 2006 2:25 pm


Return to III - Morrowind