UESP Forums

Discuss the uesp.net site and Elder Scrolls topics.
* FAQ    * Search
* Register    * Login
It is currently Sat May 04, 2024 2:04 pm

Loading

All times are UTC

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Please help to create a multi-menu MessageBox
PostPosted: Mon Aug 21, 2023 8:04 pm 
Offline
Layman
Layman

Joined: Mon Aug 21, 2023 7:36 pm
Posts: 1
ES Games: Oblivion, Morrowind
Platform: PC
UESPoints: 0
I am at loss. I read the Guide at wiki and another one at Nexus, but they are so complicated, and they only got me so far...

I want to make a book that prompts a MessageBox (above its actual contents, like in Oghma Infinium) with four initial choices when you read it both from the floor and from the inventory (hence both Activate and Equip beginnings). These choices being the three skill specializations and "exit" button. Upon clicking the specializations, another menu should appear with seven respective skills plus the "back" button. Each skill button should increase the respective skill with ModPCSkill command by one, while keeping you inside the same specialization menu. The "back" button should return you to the initial menu where you select specializations. It is way beyond my understanding. I only managed to make a single-layer menu that keeps you inside of it, when you choose the first three options.


Code:
ScriptName MyBook

short Choosing
short Choice

Begin OnActivate

   Activate
   Set Choosing to 1

End

Begin OnEquip

   Set Choosing to 1

End

Begin MenuMode

   If ( Choosing == 1 )
      MessageBox "Select Specializations", "Combat", "Magic", "Stealth", "Exit"
      Set Choosing to 2
      Set Choice to -1
   ElseIf ( Choosing == 2 )
      If ( Choice == -1 )
         Set Choice to GetButtonPressed
      ElseIf ( Choice == 0 )
         Set Choosing to 1
      ElseIf ( Choice == 1 )
         Set Choosing to 1
      ElseIf ( Choice == 2 )
         Set Choosing to 1
      ElseIf ( Choice == 3 )
         Set Choosing to 0
      EndIf
   EndIf

   If ( Choosing == 0 )
      return
   EndIf

End


Please, I have no background in coding and any feedback will be greatly appreciated.


Top
 Profile  
 
 Post subject: Re: Please help to create a multi-menu MessageBox
PostPosted: Sat Aug 26, 2023 6:51 pm 
Offline
Layman
Layman

Joined: Fri Aug 25, 2023 3:52 pm
Posts: 2
ES Games: ESO, Morrowind
Platform: PC
UESPoints: 0
I've been a VB6 programmer for about 35 years. This isn't that language, but the structure and function of If, ElseIf, EndIf is pretty universal. I think your problem may be pretty simple.

Your first If block in MenuMode checks to see if Choosing = 1. If it does, it sets Choosing = 2 and Choice = -1. So far, so good.

But then you use ElseIf. The problem is that after the program executes the If block, it skips over the ElseIf to the EndIf.

Replace

ElseIf ( Choosing == 2 )

with the following:

EndIf

If (Choosing == 2)

Hope that helps.

_________________
Balota
aka, Killer Thief Sally
"What's mine is mine and what's yours is mine. You just don't know it yet..."


Top
 Profile  
 
 Post subject: Re: Please help to create a multi-menu MessageBox
PostPosted: Sun Aug 27, 2023 10:58 pm 
Offline
Journeyman
Journeyman
User avatar

Joined: Sun Nov 23, 2014 5:23 pm
Posts: 296
Location: R'lyeh
ES Games: III, IV, V
Platform: XB1
Status: Non-Euclidean
UESPoints: 10
Firstly I would recommend starting with just one skill in your book. When the basic framework does what it's supposed to then expand it bit by bit checking it still works at every step.

I haven't written any mods for Oblivion but I had a look at the cs wiki tutorials and I think that the code for the MenuMode section (for one skill) could look something like this...

I am not 100% sure about some of the details... but I can't test it on the XBox.

Code:
Begin MenuMode

   If ( Choosing == 0 )
      return
   EndIf

   If ( Choosing == 1 )
      MessageBox "Select Specialization", "Combat", "Exit"
      Set Choosing to -1
      Set Choice to -1
   ElseIf ( Choosing == -1 )
      If ( Choice == -1 )
         Set Choice to GetButtonPressed
      ElseIf ( Choice == 0 )
         Set Choosing to 10
      ElseIf ( Choice == 1 )
         Set Choosing to 0
      EndIf

   ElseIf ( Choosing == 10 )
      MessageBox "Select Skill", "Blade", "Back"
      Set Choosing to -10
      Set Choice to -1
   ElseIf ( Choosing == -10 )
      If ( Choice == -1 )
         Set Choice to GetButtonPressed
      ElseIf ( Choice == 0 )
         ModPCSkill Blade 1
         Set Choosing to 10
      ElseIf ( Choice == 1 )
         Set Choosing to 1
      EndIf

   EndIf
End

_________________
Apathy is on the rise, but no-one cares.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Sponsored Links

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group