Jump to content

Help with scripting, script stops running when it shouldn't


bobbybobson

Recommended Posts

I would like a little help with a mod I'm writing, it is to create an amulet which uses magicka or gold to create arrows, bolts, darts etc.

I have created a slightly comlicated menu system for selecting what you want, but this no longer works and I don't know why.

 

When the amulet is equipped it asks what ammo to summon.

It should then change the question slightly and ask again, but it just seems to stop running at this point.

 

As I understand Morrowind scripts, they should run until stopped actively, so just loop through over and over. This script seems to only go through once.

 

It used to work, but since then I've added more options to the menus, and I didn't keep a backup of the old version :(

 

I've attached the mod so you can look at it. The offending script is called 'wobSmnAmmo_Control'.

 

Here is the code...

wobSmnAmmoType, wobSmnAmmoEnchant, wobSmnAmmoPay and wobSmnAmmoBow are global variables.

wobSmnAmmo_Create and wobSmnAmmo_Delete are scripts that fully work (verified by manually setting the globals then starting the scripts).

Begin wobSmnAmmo_Control

;Variables......................................................................
.......

Short OnPCEquip
Short CState ;Overall control state

Short QButton ;Button pressed in message box

Short QAmmoType ;= 0 - 3 : 0=Arrow, 1=Bolt, 2=Dart, 3=Star
Short QSmnBow ;= 0 - 1 : 0=No, 1=Yes
Short QPayType ;= 0 - 1 : 0=Magicka, 1=Gold
Short QEnchantType ;= 0 - 4 : 0=None, 1=Damage, 2=AoE, 3=Draining, 4=Other
Short QEnchant ;= 0 - 5 : Depends on QEnchantType

Short TState ;= 0000 - 3114

;Inventory control.....................................................................

if ( OnPCEquip == 1 )
if ( CState == 0 )
	Set CState to 10
endif
endif

if ( OnPCEquip == 0 )
if ( CState > 0 )
	StartScript wobSmnAmmo_Delete
	Set CState to 0
endif
endif

;Questions......................................................................
.......

if ( CState == 10 )

;Bow summoning is only for arrows and bolts
if ( QAmmoType > 1 )
	Set QSmnBow to 0
endif
;Reduces number of nested ifs needed
Set TState to ( ( QAmmoType * 1000 ) + ( QSmnBow * 100 ) + ( QPayType * 10 ) + ( QEnchantType ) )

if ( TState == 0000 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 0001 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0002 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Magicka" "Enchantment type: Area damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0003 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 0004 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 0010 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 0011 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0012 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Gold" "Enchantment type: Area damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0013 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 0014 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: No" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 0100 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 0101 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0102 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Magicka" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0103 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 0104 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 0110 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 0111 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0112 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Gold" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 0113 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 0114 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Arrow" "Summon longbow: Yes" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 1000 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 1001 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1002 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Magicka" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1003 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 1004 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 1010 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 1011 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1012 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Gold" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1013 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 1014 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: No" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 1100 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 1101 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1102 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Magicka" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1103 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 1104 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 1110 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 1111 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1112 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Gold" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 1113 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 1114 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Bolt" "Summon crossbow: Yes" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 2000 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 2001 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 2002 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Magicka" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 2003 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 2004 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 2010 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 2011 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 2012 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Gold" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 2013 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 2014 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Dart" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 3000 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 3001 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 3002 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Magicka" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 3003 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 3004 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Magicka" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

elseif ( TState == 3010 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Gold" "Enchantment type: None" "None (0)" "Simple (0)" "Normal (1)" "Silver (2)"
elseif ( TState == 3011 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 3012 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Gold" "Enchantment type:Area Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
elseif ( TState == 3013 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
elseif ( TState == 3014 )
	MessageBox "Select the type of ammunition to be summoned:" "Ammo type: Star" "Summon bow: N/A" "Payment: Gold" "Enchantment type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)" "Teleporting (8)"

else
	;For debug only
	MessageBox "Unknown TState" "OK"
endif

Set CState to 20

endif

;Answers........................................................................
.......


if ( CState == 20 )
Set QButton to GetButtonPressed

if ( QButton == 0 )
	if ( QAmmoType >= 3 )
		Set QAmmoType to 0
	else
		Set QAmmoType to ( QAmmoType + 1 )
	endif
	Set CState to 10
	
elseif ( QButton == 1 )
	if ( QSmnBow >= 1 )
		Set QSmnBow to 0
	else
		Set QSmnBow to ( QSmnBow + 1 )
	endif
	Set CState to 10
	
elseif ( QButton == 2 )
	if ( QPayType >= 1 )
		Set QPayType to 0
	else
		Set QPayType to ( QPayType + 1 )
	endif
	Set CState to 10
	
elseif ( QButton == 3 )
	if ( QEnchantType >= 4 )
		Set QEnchantType to 0
	else
		Set QEnchantType to ( QEnchantType + 1 )
	endif
	Set CState to 10
		
elseif ( QButton == 4 )
	Set QEnchant to 0
	Set CState to 30
	
elseif ( QButton == 5 )
	Set QEnchant to 1
	Set CState to 30
	
elseif ( QButton == 6 )
	Set QEnchant to 2
	Set CState to 30
	
elseif ( QButton == 7 )
	Set QEnchant to 3
	Set CState to 30
	
elseif ( QButton == 8 )
	Set QEnchant to 4
	Set CState to 30
	
endif

endif

;Start creation........................................................................

if ( CState == 30 )

Set wobSmnAmmoType to QAmmoType
Set wobSmnAmmoEnchant to ( ( QEnchantType * 10 ) + QEnchant )
Set wobSmnAmmoPay to QPayType
Set wobSmnAmmoBow to QSmnBow

StartScript wobSmnAmmo_Create

Set CState to 99
endif

End wobSmnAmmo_Control

 

It's probably something really obvious, but I just can't see it :wallbash: . Any help is greatly appreciated.

Link to comment
Share on other sites

Any luck getting the script sorted wob?

 

Yes!

 

I decided to rewrite it completely using a slightly diferent menu structure.

 

Here it is if you want to see it...

 

 

Begin wobSmnAmmo

;'Variables...................................................................
..........

Short OnPCEquip
Short OnPCAdd
Short OnPCDrop

Short ControlState ;'Overall control state
Short AnsButton ;'Button pressed in message box

;GLOBALS:
;wobSmnAmmoType  = 0 - 4 : 0=None, 1=Arrows, 2=Bolts, 3=Darts, 4=Stars 
;wobSmnAmmoBow  = 0 - 1 : 0=No, 1=Yes
;wobSmnAmmoPay  = 0 - 1 : 0=Magicka; 1=Gold
;wobSmnAmmoEnchant  = 00 - 44

;'Inventory control.....................................................................

if ( OnPCEquip == 0 )
if ( ControlState > 0 )
	StartScript wobSmnAmmo_Delete
	Set ControlState to 0
endif
endif

if ( OnPCEquip == 1 )
if ( ControlState == 0 )
	Set ControlState to 10
endif
endif

;'Ammo type............................................................................
.

if ( ControlState == 10 )
MessageBox "Select the type of ammunition to be summoned" "None" "Arrows" "Arrows & Longbow" "Bolts" "Bolts & Crossbow" "Darts" "Stars" "Payment: Magicka"
Set ControlState to 12
endif

if ( ControlState == 11 )
MessageBox "Select the type of ammunition to be summoned" "None" "Arrows" "Arrows & Longbow" "Bolts" "Bolts & Crossbow" "Darts" "Stars" "Payment: Gold"
Set ControlState to 12
endif

if ( ControlState == 12 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	Set wobSmnAmmoBow to 0
	if ( AnsButton == 0 )
		Set wobSmnAmmoType to 0
		Set ControlState to 99
	elseif ( AnsButton == 1 )
		Set wobSmnAmmoType to 1
		Set wobSmnAmmoBow to 0
		Set ControlState to 20
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoType to 1
		Set wobSmnAmmoBow to 1
		Set ControlState to 20
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoType to 2
		Set wobSmnAmmoBow to 0
		Set ControlState to 20
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoType to 2
		Set wobSmnAmmoBow to 1
		Set ControlState to 20
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoType to 3
		Set ControlState to 20
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoType to 4
		Set ControlState to 20
	elseif ( AnsButton == 7 )
		if ( wobSmnAmmoPay == 0 )
			Set wobSmnAmmoPay to 1
			Set ControlState to 11
		else
			Set wobSmnAmmoPay to 0
			Set ControlState to 10
		endif
	endif
endif
endif

;'Enchantment.................................................................
..........

if ( ControlState == 20 )
MessageBox "Select enchantment" "[back]" "Type: None" "Simple (0)" "Normal (1)" "Silver (2)" "Wild (2)" "Deadly (10)"
Set ControlState to 21
endif

if ( ControlState == 21 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	if ( AnsButton == 0 )
		if ( wobSmnAmmoPay == 0 )
			Set ControlState to 10
		else
			Set ControlState to 11
		endif
	elseif ( AnsButton == 1 )
		Set ControlState to 22
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoEnchant to 00
		Set ControlState to 30
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoEnchant to 01
		Set ControlState to 30
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoEnchant to 02
		Set ControlState to 30
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoEnchant to 03
		Set ControlState to 30
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoEnchant to 04
		Set ControlState to 30
	endif
endif
endif


if ( ControlState == 22 )
MessageBox "Select enchantment" "[back]" "Type: Damage" "Fire (3)" "Frost (3)" "Shock (3)" "Poison (3)" "Health (3)"
Set ControlState to 23
endif

if ( ControlState == 23 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	if ( AnsButton == 0 )
		if ( wobSmnAmmoPay == 0 )
			Set ControlState to 10
		else
			Set ControlState to 11
		endif
	elseif ( AnsButton == 1 )
		Set ControlState to 24
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoEnchant to 10
		Set ControlState to 30
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoEnchant to 11
		Set ControlState to 30
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoEnchant to 12
		Set ControlState to 30
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoEnchant to 13
		Set ControlState to 30
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoEnchant to 14
		Set ControlState to 30
	endif
endif
endif


if ( ControlState == 24 )
MessageBox "Select enchantment" "[back]" "Type: Area damage" "Fire (5)" "Frost (5)" "Shock (5)" "Poison (5)" "Health (5)"
Set ControlState to 25
endif

if ( ControlState == 25 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	if ( AnsButton == 0 )
		if ( wobSmnAmmoPay == 0 )
			Set ControlState to 10
		else
			Set ControlState to 11
		endif
	elseif ( AnsButton == 1 )
		Set ControlState to 26
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoEnchant to 20
		Set ControlState to 30
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoEnchant to 21
		Set ControlState to 30
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoEnchant to 22
		Set ControlState to 30
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoEnchant to 23
		Set ControlState to 30
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoEnchant to 24
		Set ControlState to 30
	endif
endif
endif


if ( ControlState == 26 )
MessageBox "Select enchantment" "[back]" "Type: Draining" "Health (10)" "Magicka (10)" "Fatigue (10)" "Speed (10)" "Intelligence (10)"
Set ControlState to 27
endif

if ( ControlState == 27 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	if ( AnsButton == 0 )
		if ( wobSmnAmmoPay == 0 )
			Set ControlState to 10
		else
			Set ControlState to 11
		endif
	elseif ( AnsButton == 1 )
		Set ControlState to 28
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoEnchant to 30
		Set ControlState to 30
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoEnchant to 31
		Set ControlState to 30
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoEnchant to 32
		Set ControlState to 30
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoEnchant to 33
		Set ControlState to 30
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoEnchant to 34
		Set ControlState to 30
	endif
endif
endif


if ( ControlState == 28 )
MessageBox "Select enchantment" "[back]" "Type: Other" "Paralyze (20)" "Silence (20)" "Burden (20)" "Soultrap (2)"
Set ControlState to 29
endif

if ( ControlState == 29 )
Set AnsButton to GetButtonPressed
if ( AnsButton < 0 )
	return
else
	if ( AnsButton == 0 )
		if ( wobSmnAmmoPay == 0 )
			Set ControlState to 10
		else
			Set ControlState to 11
		endif
	elseif ( AnsButton == 1 )
		Set ControlState to 20
	elseif ( AnsButton == 2 )
		Set wobSmnAmmoEnchant to 40
		Set ControlState to 30
	elseif ( AnsButton == 3 )
		Set wobSmnAmmoEnchant to 41
		Set ControlState to 30
	elseif ( AnsButton == 4 )
		Set wobSmnAmmoEnchant to 42
		Set ControlState to 30
	elseif ( AnsButton == 5 )
		Set wobSmnAmmoEnchant to 43
		Set ControlState to 30
	elseif ( AnsButton == 6 )
		Set wobSmnAmmoEnchant to 44
		Set ControlState to 30
	endif
endif
endif

;'Start creation........................................................................

if ( ControlState == 30 )
StartScript wobSmnAmmo_Create
Set ControlState to 99
endif

End wobSmnAmmo

 

 

 

I still don't know why this works and the previous code doesn't.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...