Jump to content

MessageBox assistance


Recommended Posts

Okay, I am creating a script attached to an anvil, that brings up a menu asking what armor you want to make. I plan to incorporate item requirements and everything but I need to get the script working first. As far as the message boxes themselves go, all is working well. It's the button press not doing its thing. I.e in the script I have "Boots" and when that button is selected a message should pop up saying "Bronze boots added" but this is not happening. Oblivion messagebox is a foreign language to me and so much different than Morrowind. Anyway, here's the script if someone can help point out my flaw.

scn RizAnvilScript

short state
short button
short bronze
short iron
short steel
short mithril
short adamant
short rune
short showMenu

begin onactivate

	let showMenu := 1

	set state to 0
	set bronze to 0
	set iron to 0
	set steel to 0
	set mithril to 0
	set adamant to 0
	set rune to 0

	if state == 0
		MessageBoxEX "Please select an armor group !|Bronze|Iron|Steel|Mithril|Adamant|Rune|Exit"
		set state to 1
	endif
	
end	

begin gamemode

	if state == 1
			
		if showMenu

			let button := GetButtonPressed

			if button != -1

				Let showMenu := 0
				
				if button == 0
					set bronze to 1
				elseif button == 1
					set iron to 1
				elseif button == 2
					set steel to 1
				elseif button == 3
					set mithril to 1
				elseif button == 4
					set adamant to 1
				elseif button == 5
					set rune to 1
				endif
			endif
		endif
	endif

	if bronze == 1
		MessageBoxEX "Select an armor piece |Boots|Gauntlets|Helmet|Greaves|Platebody|Exit"
		set bronze to 2
	endif

	if bronze == 2

		if showMenu 

			let button := GetButtonPressed

			if button != -1

				let showMenu := 0
				
				if button == 0
					MessageEX "Bronze boots added"
				elseif button == 1
					MessageEX "Bronze gauntlets added"
				elseif button == 2
					MessageEX "Bronze helemt added"
				elseif button == 3
					MessageEX "Bronze greaves added"
				elseif button == 4
					MessageEX "Bronze platebody added"
				elseif button == 5
				endif
			endif
		endif
	endif
	
end
		
Edited by Rizalgar
Link to comment
Share on other sites

reset values of 'button' and 'state'

I chose state == 2 so it wouldn't effect the times when its set to 0 or 1

basically taking it out of the fight

            if button != -1

                Let showMenu := 0
                
                if button == 0
                    set bronze to 1
                elseif button == 1
                    set iron to 1
                elseif button == 2
                    set steel to 1
                elseif button == 3
                    set mithril to 1
                elseif button == 4
                    set adamant to 1
                elseif button == 5
                    set rune to 1
                endif

                set button == -1  ;  <<<<<< ADDED CODE >>>>>>>>>
                set state == 2 ;     <<<<<< ADDED CODE  >>>>>
            endif
Link to comment
Share on other sites

That's a big ol negative, boss. I thought you would be right and that maybe the button presses were still calling from the state instead of the bronze but doesn't seem to be the case. Ah well. I'll still be trying to figure it out

Link to comment
Share on other sites

Why people always label themselves as "idiots" only because of a quick simple oversight on their part is totally beyond me. These happen to all of us at one point or another, even to me. And I'm very good at spotting mistakes, be it syntactical or logical, from the glimpse of an eye. (Between us two, my stomach becomes uneasy while reading a mistake, even though often I myself don't yet know where or what exactly it is. Makes it pretty easy finding them though I tell you, if you immediately know "this is wrong" and just have to find out "why".)

Link to comment
Share on other sites

Yeah, don't worry about making mistakes so much here.

I'm surely not a professional programmer myself and feel like

a bull in a china shop sometimes trying to make my code work out.

 

Try this.

FAIL

ARghhh try this then

FAIL

dad gummit

OK, how bout this

BLEHHH

Oh wait, I see it.

SWeeet

 

 

messagebox is probably one of my biggest WHY CAN"T I MAKE THIS WORK FOR MY MOD?!?!?! moments.

For my own mod, I had to drop it completely and learn XML to create my own menusystem.

IT worked out way better for my mod which had become a monstrously complicated work that has went way out of control muahaha

Unfortunately for my mod, I've ran into a bit of a slump. Between writers block of sorts and doing other things, its been on hold a bit.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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