Script Help, please!

Post » Fri Dec 12, 2014 4:53 pm

Trying to get this script to run. Have it based off of an equippable misc. item. It's supposed to give you armor based on your choices, once within a level range, and only within your level range, wheather or not you acutally used it beforehand.

Guess what it's not doing? Yep, not giving the armor. Can someone look it over and see where I went wrong here?

scn ArmorLevellershort Choiceshort Choosingshort ArmorTokenbegin onEquip	set Choosing to -1	if  player.getlevel <= 3 && ArmorToken > 1		set ArmorToken to 1	elseif player.getlevel <= 6 && ArmorToken > 2		set ArmorToken to 2	elseif player.getlevel <= 10 && ArmorToken > 3		set ArmorToken to 3	elseif player.getlevel <=15 && ArmorToken > 4		set ArmorToken to 4	elseif player.getlevel <=20 && ArmorToken > 5		set ArmorToken to 5	endifendbegin gamemode	if (Choosing == 0)		return	elseif (Choosing == -1)		Messagebox "Would you like to upgrade your armor?" "Yes" "No"		set Choosing to 1		set Choice to -1	elseif (Choosing == 1)		if (Choice == -1)			set Choice to GetButtonPressed		elseif (Choice == 0)			set Choosing to 2		elseif (Choice == 1)			set Choosing to 0		endif	elseif (Choosing == 2)		Messagebox "What armor would you like to upgrade?" "Light" "Heavy"		set Choosing to 3		set Choice to -1		set ArmorToken to 0	elseif (Choosing == 3)		if (Choice == -1)			set Choice to GetButtonPressed		elseif (Choice == 0)			if  player.getlevel > 3 && ArmorToken == 0				player.additem FurBoots 1				player.additem FurCuirassH 1				player.additem FurGauntlets 1				player.additem FurGreavesH 1				player.additem FurHelmet 1				player.additem FurShield 1				set ArmorToken to 1			elseif player.getlevel <= 3 && ArmorToken == 1				player.additem LeatherBoots 1				player.additem LeatherCuirassH 1				player.additem LeatherGauntlets 1				player.additem LeatherGreavesH 1				player.additem LeatherHelmet 1				player.additem LeatherShield 1				set ArmorToken to 2			elseif player.getlevel <= 6 && ArmorToken == 2				player.additem ChainmailBoots 1				player.additem ChainmailCuirassH 1				player.additem ChainmailGauntlets 1				player.additem ChainmailGreavesH 1				player.additem ChainmailHelmet 1				player.additem ChainmailShield 1				set ArmorToken to 3			elseif player.getlevel <= 10 && ArmorToken == 3				player.additem MithrilBoots 1				Player.additem MithrilCuirassH 1				player.additem MithrilGauntlets 1				player.additem MithrilGreavesH 1				player.additem MithrilHelmet 1				player.additem MithrilShield 1				set ArmorToken to 4			elseif player.getlevel <=15 && ArmorToken == 4				player.additem ElvenBoots 1				player.additem ElvenCuirassH 1				player.additem ElvenGauntlets 1				player.additem ElvenGreavesH 1				player.additem ElvenHelmet 1				player.additem ElvenShield 1				set ArmorToken to 5			elseif player.getlevel <= 20 && ArmorToken == 5				player.additem GlassBoots 1				player.additem GlassCuirassH 1				player.additem GlassGauntlets 1				player.additem GlassGreavesH 1				player.additem GlassHelmet 1				player.additem GlassShield 1				set ArmorToken to 6			endif		return		elseif (Choice == 1)			if  player.getlevel > 3 && ArmorToken == 0				player.additem IronBoots 1				player.additem IronCuirassH 1				player.additem IronGauntlets 1				player.additem IronGreavesH 1				player.additem IronHelmet 1				player.additem IronShield 1				set ArmorToken to 1			elseif player.getlevel <= 3 && ArmorToken == 1				player.additem SteelBoots 1				player.additem SteelCuirassH 1				player.additem SteelGauntlets 1				player.additem SteelGreavesH 1				player.additem SteelHelmet 1				player.additem SteelShield 1				set ArmorToken to 2			elseif player.getlevel <= 6 && ArmorToken == 2				player.additem DwarvenBoots 1				player.additem DwarvenCuirassH 1				player.additem DwarvenGauntlets 1				player.additem DwarvenGreavesH 1				player.additem DwarvenHelmet 1				player.additem DwarvenShield 1				set ArmorToken to 3			elseif player.getlevel <= 10 && ArmorToken == 3				player.additem OrcishBoots 1				Player.additem OrcishCuirassH 1				player.additem OrcishGauntlets 1				player.additem OrcishGreavesH 1				player.additem OrcishHelmet 1				player.additem OrcishShield 1				set ArmorToken to 4			elseif player.getlevel <=15 && ArmorToken == 4				player.additem EbonyBoots 1				player.additem EbonyCuirassH 1				player.additem EbonyGauntlets 1				player.additem EbonyGreavesH 1				player.additem EbonyHelmet 1				player.additem EbonyShield 1				set ArmorToken to 5			elseif player.getlevel <= 20 && ArmorToken == 5				player.additem DaedricBoots 1				player.additem DaedricCuirassH 1				player.additem DaedricGauntlets 1				player.additem DaedricGreavesH 1				player.additem DaedricHelmet 1				player.additem DaedricShield 1				set ArmorToken to 6			endif		return			endif		endif	endifend
User avatar
Darren
 
Posts: 3354
Joined: Wed Jun 06, 2007 2:33 pm

Post » Fri Dec 12, 2014 10:13 pm

Ok, got it working as intended.

... got my > and < mixed up. And the if blocks weren't in ( ). :facepalm:

For those wondering how this script is working...

The "begin onEquip" section has a string of code that checks your level and gives you an "armor token" variable. That variable works in the main body, to check to see if you have already upgraded or not, and assign you the right level of armor if you have not. The reason for that code is as a failsafe if you forget to use it for a level range, or don't have it at level 1 or 2 and use it. Otherwise, you use it and you won't get any armor ever again.

I've also added a messagebox with an else statement at the end of the main body and added a "set Choosing to 0"; not sure if the script keep looping if none of the criteria are met, but it's better to be safe and exit it like that.

The fixed script is as follows:

scn ArmorLevellershort Choiceshort Choosingshort ArmorTokenbegin onEquip	set Choosing to -1	if (player.getlevel >= 3 && ArmorToken < 1)		set ArmorToken to 1	elseif (player.getlevel >= 6 && ArmorToken < 2)		set ArmorToken to 2	elseif (Player.getlevel >= 10 && ArmorToken < 3)		set ArmorToken to 3	elseif (player.getlevel >= 15 && ArmorToken < 4)		set ArmorToken to 4	elseif (player.getlevel >= 20 && ArmorToken < 5)		set ArmorToken to 5	endifendbegin gamemode	if (Choosing == 0)		return	elseif (Choosing == -1)		Messagebox "Would you like to upgrade your armor?" "Yes" "No"		set Choosing to 1		set Choice to -1	elseif (Choosing == 1)		if (Choice == -1)			set Choice to GetButtonPressed		elseif (Choice == 0)			set Choosing to 2		elseif (Choice == 1)			set Choosing to 0		endif	elseif (Choosing == 2)		Messagebox "What armor would you like to upgrade?" "Light" "Heavy"		set Choosing to 3		set Choice to -1	elseif (Choosing == 3)		if (Choice == -1)			set Choice to GetButtonPressed		elseif (Choice == 0)			if  (player.getlevel < 3 && ArmorToken == 0)				player.additem FurBoots 1				player.additem FurCuirassH 1				player.additem FurGauntlets 1				player.additem FurGreavesH 1				player.additem FurHelmet 1				player.additem FurShield 1				set ArmorToken to 1				set Choosing to 0			elseif (player.getlevel >= 3 && ArmorToken == 1)				player.additem LeatherBoots 1				player.additem LeatherCuirassH 1				player.additem LeatherGauntlets 1				player.additem LeatherGreavesH 1				player.additem LeatherHelmet 1				player.additem LeatherShield 1				set ArmorToken to 2				set Choosing to 0			elseif (player.getlevel >= 6 && ArmorToken == 2)				player.additem ChainmailBoots 1				player.additem ChainmailCuirassH 1				player.additem ChainmailGauntlets 1				player.additem ChainmailGreavesH 1				player.additem ChainmailHelmet 1				player.additem ChainmailShield 1				set ArmorToken to 3				set Choosing to 0			elseif (player.getlevel >= 10 && ArmorToken == 3)				player.additem MithrilBoots 1				Player.additem MithrilCuirassH 1				player.additem MithrilGauntlets 1				player.additem MithrilGreavesH 1				player.additem MithrilHelmet 1				player.additem MithrilShield 1				set ArmorToken to 4				set Choosing to 0			elseif (player.getlevel >=15 && ArmorToken == 4)				player.additem ElvenBoots 1				player.additem ElvenCuirassH 1				player.additem ElvenGauntlets 1				player.additem ElvenGreavesH 1				player.additem ElvenHelmet 1				player.additem ElvenShield 1				set ArmorToken to 5				set Choosing to 0			elseif (player.getlevel >= 20 && ArmorToken == 5)				player.additem GlassBoots 1				player.additem GlassCuirassH 1				player.additem GlassGauntlets 1				player.additem GlassGreavesH 1				player.additem GlassHelmet 1				player.additem GlassShield 1				set ArmorToken to 6				set Choosing to 0			else				MessageBox "You cannot upgrade your armor any further at this time." "Ok"				set Choosing to 0			endif		elseif (Choice == 1)			if  (player.getlevel < 3 && ArmorToken == 0)				player.additem IronBoots 1				player.additem IronCuirassH 1				player.additem IronGauntlets 1				player.additem IronGreavesH 1				player.additem IronHelmet 1				player.additem IronShield 1				set ArmorToken to 1				set Choosing to 0			elseif (player.getlevel >= 3 && ArmorToken == 1)				player.additem SteelBoots 1				player.additem SteelCuirassH 1				player.additem SteelGauntlets 1				player.additem SteelGreavesH 1				player.additem SteelHelmet 1				player.additem SteelShield 1				set ArmorToken to 2				set Choosing to 0			elseif (player.getlevel >= 6 && ArmorToken == 2)				player.additem DwarvenBoots 1				player.additem DwarvenCuirassH 1				player.additem DwarvenGauntlets 1				player.additem DwarvenGreavesH 1				player.additem DwarvenHelmet 1				player.additem DwarvenShield 1				set ArmorToken to 3				set Choosing to 0			elseif (player.getlevel >= 10 && ArmorToken == 3)				player.additem OrcishBoots 1				Player.additem OrcishCuirassH 1				player.additem OrcishGauntlets 1				player.additem OrcishGreavesH 1				player.additem OrcishHelmet 1				player.additem OrcishShield 1				set ArmorToken to 4				set Choosing to 0			elseif (player.getlevel >=15 && ArmorToken == 4)				player.additem EbonyBoots 1				player.additem EbonyCuirassH 1				player.additem EbonyGauntlets 1				player.additem EbonyGreavesH 1				player.additem EbonyHelmet 1				player.additem EbonyShield 1				set ArmorToken to 5				set Choosing to 0			elseif (player.getlevel >= 20 && ArmorToken == 5)				player.additem DaedricBoots 1				player.additem DaedricCuirassH 1				player.additem DaedricGauntlets 1				player.additem DaedricGreavesH 1				player.additem DaedricHelmet 1				player.additem DaedricShield 1				set ArmorToken to 6				set Choosing to 0			else				messagebox "You cannot upgrade your armor any further at this time." "Ok"				set Choosing to 0			endif			endif		endif	endifend
User avatar
LADONA
 
Posts: 3290
Joined: Wed Aug 15, 2007 3:52 am


Return to IV - Oblivion

cron