Jump to content

Smelting again


bencebence

Recommended Posts

Hey everybody.

Sorry for the last post, but this time I really need help.

I had a working smelting script, but I edited some things in it, and now it seems like it doesn't working. Do anyone know what is the problem with it? (Construction set gives no errors)

 

ScriptName RaivenSmelt

Short copperorecount
Short coalcount
Short pureironorecount
Short mithrilorecount
Short ayliiteorecount
Short dwarfiteorecount
Short tinorecount
Short ironorecount
Short silverorecount
Short goldorecount
Short daedriteorecount
Short crystaliteorecount
Short ebonyorecount

Short armorerskill
Short chance
Short apron
Short gear
Short menulevel
Short button

short crystalitebarsmade
short crystaliteremoved
short ebonybarsmade
short ebonyremoved
Short ironbarsmade
Short ironremoved
Short copperbarsmade
Short copperremoved
Short tinremoved
Short mithrilbarsmade
Short mithrilremoved
Short bronzebarsmade
Short bronzeremoved
Short steelbarsmade
Short coalremoved
Short coalremoved1
Short coalremoved2
Short coalremoved3
Short coalremoved4
Short coalremoved5
Short coalremoved6
Short coalremoved7
Short coalremoved8
Short dwarvenbarsmade
Short dwarvenremoved
Short silverbarsmade
Short silverremoved
Short ayliitebarsmade
Short ayliiteremoved
Short pureironremoved
Short daedricbarsmade
Short daedriteremoved

Begin OnActivate
set armorerskill to player.getactorvalue armorer
set apron to player.getequipped LowerShirt01
set gear to apron
if gear == 1
	messagebox "What kind of bar would you like to create?", "Iron", "Copper", "Bronze", "Steel", "Ayliite", "Dwarven", "Mithril", "Crystalite", "Ebony", "Daedric", "Cancel"
	set menulevel to 1
else
	Message "Not wearing suitable gear."
endif
end


Begin gamemode
set ironorecount to player.getitemcount IroneOre
set pureironorecount to player.getitemcount PureIronOre
set mithrilorecount to player.getitemcount MithrilOre
set ayliiteorecount to player.getitemcount AyliiteOre
set tinorecount to player.getitemcount TinOre
set daedriteorecount to player.getitemcount DaedriteOre
set copperorecount to player.getitemcount CopperOre
set coalcount to player.getitemcount Coal
set silverorecount to player.getitemcount gem0silvernugget
set goldorecount to player.getitemcount gem0goldnugget
set crystaliteorecount to player.getitemcount crystaliteore
set ebonyorecount to player.getitemcount EbonOre
set chance to 1 + 0.3*getrandompercent
set armorerskill to player.getactorvalue armorer + chance

set copperbarsmade to copperorecount/2
	set copperbarsmade to coalcount
set copperremoved to copperbarsmade*2
	set coalremoved to copperbarsmade

set bronzebarsmade to copperorecount/2
set bronzebarsmade to tinorecount/2
set copperremoved to copperbarsmade*2
set tinremoved to copperbarsmade

set ironbarsmade to ironorecount/2
set ironbarsmade to coalcount/2
set ironremoved to ironbarsmade*2
set coalremoved1 to ironbarsmade*2

set steelbarsmade to pureironorecount/2
set steelbarsmade to coalcount/3
set pureironremoved to steelbarsmade*2
set coalremoved2 to steelbarsmade*3

set mithrilbarsmade to mithrilorecount/2
set mithrilbarsmade to coalcount/3
set mithrilremoved to mithrilbarsmade*2
set coalremoved3 to mithrilbarsmade*3

set crystalitebarsmade to crystaliteorecount/2
set crystalitebarsmade to coalcount/3
set crystaliteremoved to crystalitebarsmade*2
set coalremoved7 to crystalitebarsmade*3

set ebonybarsmade to ebonyorecount/2
set ebonybarsmade to coalcount/3
set ebonyremoved to ebonybarsmade*2
set coalremoved3 to ebonybarsmade*3

set dwarvenbarsmade to dwarfiteorecount/2
set dwarvenbarsmade to coalcount/3
set dwarvenremoved to dwarvenbarsmade*2
set coalremoved4 to dwarvenbarsmade*3

set ayliitebarsmade to ayliiteorecount*2
set ayliitebarsmade to coalcount*3
set ayliiteremoved to ayliitebarsmade*2
set coalremoved5 to ayliitebarsmade*3

set daedricbarsmade to daedriteorecount/3
set daedricbarsmade to coalcount/5
set daedriteremoved to daedricbarsmade*3
set coalremoved6 to daedricbarsmade*5
	

if (menulevel == 1)
	set button to getbuttonpressed
		if (button > -1)
			if (button == 0 && ironbarsmade > 0)
				if (armorerskill > 10)
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splfireballfail
					player.additem IronBar ironbarsmade
					message "Smlething succeed."
				else
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splpoisonhit
					message "Smelting failed."
			elseif (button == 1 && copperbarsmade > 0)
				if (armorerskill > 1)
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splfireballfail
					player.additem CopperBar copperbarsmade
					message "Smlething succeed."
				else
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 2 && bronzebarsmade > 0)
				if (armorerskill > 5)
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splfireballfail
					player.additem BronzeBar bronzebarsmade
					message "Smlething succeed."
				else
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 3 && steelbarsmade > 0)
				if (armorerskill > 15)
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splfireballfail
					player.additem SteelBar steelbarsmade
					message "Smlething succeed."
				else
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 4 && ayliitebarsmade > 0)
				if (armorerskill > 25)
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splfireballfail
					player.additem AyliiteBar ayliitebarsmade
					message "Smlething succeed."
				else
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 5 && dwarvenbarsmade > 0)
				if (armorerskill > 30)
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splfireballfail
					player.additem DwarvenBar dwarvenbarsmade
					message "Smlething succeed."
				else
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 6 && mithrilbarsmade > 0)
				if (armorerskill > 30)
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splfireballfail
					player.additem MithrilBar mithrilbarsmade
					message "Smlething succeed."
				else
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 7 && crystalitebarsmade > 0)
				if (armorerskill > 45)
					player.removeitem CrystaliteOre crystaliteremoved
					player.removeitem Coal coalremoved7
					playsound splfireballfail
					player.additem CrystaliteBar crystalitebarsmade
					message "Smlething succeed."
				else
					player.removeitem CrystaliteOre Crystaliteremoved
					player.removeitem Coal coalremoved7
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 8 && ebonybarsmade > 0)
				if (armorerskill > 55)
					player.removeitem EbonOre ebonyremoved
					player.removeitem Coal coalremoved8
					playsound splfireballfail
					player.additem EbonyBar Ebonybarsmade
					message "Smlething succeed."
				else
					player.removeitem EbonOre ebonyremoved
					player.removeitem Coal coalremoved8
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 9 && daedricbarsmade > 0)
				if (armorerskill > 70)
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splfireballfail
					player.additem DaedricBar daedricbarsmade
					message "Smlething succeed."
				else
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 10)
				message "Smelting cancelled."
			else
				message "Smelting failed.  Not enough raw materials."
			endif
		endif
	endif
endif
end

 

Thanks in advance,

 

bencebence

Link to comment
Share on other sites

You still haven't corrected the missing endif, instead adding another at the end which is going to throw the whole script out. Remove one of the EndIf statements from the very end of the script and place it immediately after the very first smelting failed message. IE:

if (menulevel == 1)
               set button to getbuttonpressed
                       if (button > -1)
                               if (button == 0 && ironbarsmade > 0)
                                       if (armorerskill > 10)
                                               player.removeitem IroneOre ironremoved
                                               player.removeitem Coal coalremoved1
                                               playsound splfireballfail
                                               player.additem IronBar ironbarsmade
                                               message "Smlething succeed."
                                       else
                                               player.removeitem IroneOre ironremoved
                                               player.removeitem Coal coalremoved1
                                               playsound splpoisonhit
                                               message "Smelting failed."
                               elseif (button == 1 && copperbarsmade > 0)

Should be

[codebox]if (menulevel == 1)
               set button to getbuttonpressed
                       if (button > -1)
                               if (button == 0 && ironbarsmade > 0)
                                       if (armorerskill > 10)
                                               player.removeitem IroneOre ironremoved
                                               player.removeitem Coal coalremoved1
                                               playsound splfireballfail
                                               player.additem IronBar ironbarsmade
                                               message "Smlething succeed."
                                       else
                                               player.removeitem IroneOre ironremoved
                                               player.removeitem Coal coalremoved1
                                               playsound splpoisonhit
                                               message "Smelting failed."
                                       ENDIF ;************************************************8
                               elseif (button == 1 && copperbarsmade > 0)

 

All of the other errors I identified in your first thread are still in there too.

Edited by Skevitj
Link to comment
Share on other sites

The very first one?

Here:

					if (armorerskill > 10)
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splfireballfail
					player.additem IronBar ironbarsmade
					message "Smlething succeed."
				else
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splpoisonhit
					message [color="#00FF00"][b]"Smelting failed."[/b][/color]
			elseif (button == 1 && copperbarsmade > 0)

?

Link to comment
Share on other sites

And how can I add two items like I did? You told me that two sets write over each other, then how can I do it?

I mean this part:

	set ebonybarsmade to ebonyorecount/2
set ebonybarsmade to coalcount/3
set ebonyremoved to ebonybarsmade*2
set coalremoved3 to ebonybarsmade*3

Link to comment
Share on other sites

Hey again,

I followed what you told me, my script now looks like this:

ScriptName RaivenSmelt

Short copperorecount
Short coalcount
Short pureironorecount
Short mithrilorecount
Short ayliiteorecount
Short dwarfiteorecount
Short tinorecount
Short ironorecount
Short silverorecount
Short goldorecount
Short daedriteorecount
Short crystaliteorecount
Short ebonyorecount

Short armorerskill
Short chance
Short menulevel
Short button

short crystalitebarsmade
short crystaliteremoved
short ebonybarsmade
short ebonyremoved
Short ironbarsmade
Short ironremoved
Short copperbarsmade
Short copperremoved
Short tinremoved
Short mithrilbarsmade
Short mithrilremoved
Short bronzebarsmade
Short bronzeremoved
Short steelbarsmade
Short coalremoved
Short coalremoved1
Short coalremoved2
Short coalremoved3
Short coalremoved4
Short coalremoved5
Short coalremoved6
Short coalremoved7
Short coalremoved8
Short dwarvenbarsmade
Short dwarvenremoved
Short silverbarsmade
Short silverremoved
Short ayliitebarsmade
Short ayliiteremoved
Short pureironremoved
Short daedricbarsmade
Short daedriteremoved

Begin OnActivate
set armorerskill to player.getactorvalue armorer
if player.getequipped LowerShirt01
	messagebox "What kind of bar would you like to create?", "Iron", "Copper", "Bronze", "Steel", "Ayliite", "Dwarven", "Mithril", "Crystalite", "Ebony", "Daedric", "Cancel"
	set menulevel to 1
else
	Message "Not wearing suitable gear."
endif
end


Begin gamemode
set ironorecount to player.getitemcount IroneOre
set pureironorecount to player.getitemcount PureIronOre
set mithrilorecount to player.getitemcount MithrilOre
set ayliiteorecount to player.getitemcount AyliiteOre
set tinorecount to player.getitemcount TinOre
set daedriteorecount to player.getitemcount DaedriteOre
set copperorecount to player.getitemcount CopperOre
set coalcount to player.getitemcount Coal
set silverorecount to player.getitemcount gem0silvernugget
set goldorecount to player.getitemcount gem0goldnugget
set crystaliteorecount to player.getitemcount crystaliteore
set ebonyorecount to player.getitemcount EbonOre
set chance to 1 + 0.3*getrandompercent
set armorerskill to player.getactorvalue armorer + chance

set copperbarsmade to copperorecount/2 && coalcount
set copperremoved to copperbarsmade*2
	set coalremoved to copperbarsmade

set bronzebarsmade to copperorecount/2 && tinorecount/2
set copperremoved to copperbarsmade*2
set tinremoved to copperbarsmade

set ironbarsmade to ironorecount/2 && coalcount/2
set ironremoved to ironbarsmade*2
set coalremoved1 to ironbarsmade*2

set steelbarsmade to pureironorecount/2 && coalcount/3
set pureironremoved to steelbarsmade*2
set coalremoved2 to steelbarsmade*3

set mithrilbarsmade to mithrilorecount/2 && coalcount/3
set mithrilremoved to mithrilbarsmade*2
set coalremoved3 to mithrilbarsmade*3

set crystalitebarsmade to crystaliteorecount/2 && coalcount/3
set crystaliteremoved to crystalitebarsmade*2
set coalremoved7 to crystalitebarsmade*3

set ebonybarsmade to ebonyorecount/2 && coalcount/3
set ebonyremoved to ebonybarsmade*2
set coalremoved3 to ebonybarsmade*3

set dwarvenbarsmade to dwarfiteorecount/2 && coalcount/3
set dwarvenremoved to dwarvenbarsmade*2
set coalremoved4 to dwarvenbarsmade*3

set ayliitebarsmade to ayliiteorecount*/2 &&  coalcount/3
set ayliiteremoved to ayliitebarsmade*2
set coalremoved5 to ayliitebarsmade*3

set daedricbarsmade to daedriteorecount/3 && coalcount/5
set daedriteremoved to daedricbarsmade*3
set coalremoved6 to daedricbarsmade*5
	

if (menulevel == 1)
	set button to getbuttonpressed
		if (button > -1)
			if (button == 0 && ironbarsmade > 0)
				if (armorerskill >= 10)
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splfireballfail
					player.additem IronBar ironbarsmade
					message "Smelting succeed."
				else
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 1 && copperbarsmade > 0)
				if (armorerskill >= 1)
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splfireballfail
					player.additem CopperBar copperbarsmade
					message "Smelting succeed."
				else
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 2 && bronzebarsmade > 0)
				if (armorerskill >= 5)
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splfireballfail
					player.additem BronzeBar bronzebarsmade
					message "Smelting succeed."
				else
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 3 && steelbarsmade > 0)
				if (armorerskill >= 15)
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splfireballfail
					player.additem SteelBar steelbarsmade
					message "Smelting succeed."
				else
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 4 && ayliitebarsmade > 0)
				if (armorerskill >= 25)
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splfireballfail
					player.additem AyliiteBar ayliitebarsmade
					message "Smelting succeed."
				else
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 5 && dwarvenbarsmade > 0)
				if (armorerskill >= 30)
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splfireballfail
					player.additem DwarvenBar dwarvenbarsmade
					message "Smelting succeed."
				else
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 6 && mithrilbarsmade > 0)
				if (armorerskill >= 35)
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splfireballfail
					player.additem MithrilBar mithrilbarsmade
					message "Smelting succeed."
				else
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 7 && crystalitebarsmade > 0)
				if (armorerskill >= 45)
					player.removeitem CrystaliteOre crystaliteremoved
					player.removeitem Coal coalremoved7
					playsound splfireballfail
					player.additem CrystaliteBar crystalitebarsmade
					message "Smelting succeed."
				else
					player.removeitem CrystaliteOre Crystaliteremoved
					player.removeitem Coal coalremoved7
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 8 && ebonybarsmade > 0)
				if (armorerskill >= 55)
					player.removeitem EbonOre ebonyremoved
					player.removeitem Coal coalremoved8
					playsound splfireballfail
					player.additem EbonyBar Ebonybarsmade
					message "Smelting succeed."
				else
					player.removeitem EbonOre ebonyremoved
					player.removeitem Coal coalremoved8
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 9 && daedricbarsmade > 0)
				if (armorerskill >= 70)
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splfireballfail
					player.additem DaedricBar daedricbarsmade
					message "Smelting succeed."
				else
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 10)
				message "Smelting cancelled."
			else
				message "Smelting failed.  Not enough raw materials."
		endif
	endif
endif
end

But now I can't even activate it. Why?

Link to comment
Share on other sites

Your scripts always look so long. :sweat:

 

Anyway, you're saying that not even the menu pops up when you activate it? That's weird, nothing important was changed in the OnActivate block between what you first posted and what you last posted.

 

Here's some mistakes I notice in the script:

 

You have more than 10 buttons in your menu.

You have lines like this with '&&' (it doesn't work) :

set copperbarsmade to copperorecount/2 && coalcount

You're missing lines setting menulevel back to 0 after you finish doing stuff.

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

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