Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Help With Menus

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Mon Jul 14, 2008 11:02 am    Post subject: Help With Menus Reply with quote

I'm trying to create a custom item menu so I can add information about item weight. The plotscript seems pretty straightforward, but some basic commands just don't seem to be working like there supposed to. Specifically, I'm dynamically creating a menu with the 'create menu' and then trying to put it on top of other open menus with the 'bring menu forward command'. However, the menu always pops up under the main menu.

Additionally, I want to display a menu item that is really a message saying your inventory is empty when appropriate, and I'm grabbing the string from a text box. However, I just get a blank caption in the menu instead. I have verified that I'm pulling the right line from the right text box. Any ideas? Here's the relevant code:

Code:
#string constants
define constant(1, ITEM_MENU_STRING) #string id used from creating item menu captions
define constant(6, ITEM_MENU_MESSAGES_TEXT_BOX) #the text box used to hold item menu messages
define constant(1, YOU_ARE_EMPTY_HANDED_MESSAGE)

#create and show an item menu including item weight
plotscript, open item menu, begin
   variable(curMenu)
   curMenu := create menu
   set menu text align(curMenu, align:left)
   
   variable(loop)
   for(loop, 0, MAX_ITEM_ID, 1) do(
      #if true, give the player an explanatory (and disabled) menu item explaining that they are empty handed
      variable(isEmptyHanded)
      isEmptyHanded := true
      
      #loop through all possible items, adding a menu item wherever our inventory count is non-zero
      if (inventory(loop) >> 0) then(
         variable(curMenuItem)
         curMenuItem := add menu item(curMenu)
         
         #build the menu item caption, starting with the item name
         get item name(ITEM_MENU_STRING, loop)
         
         #append a ': ' to the item name
         append ascii(ITEM_MENU_STRING, 58)
         append ascii(ITEM_MENU_STRING, 32)
         
         #finally, append the number you have to the item menu
         append number(ITEM_MENU_STRING, inventory(loop))
         
         set menu item caption(curMenuItem, ITEM_MENU_STRING)
         
         isEmptyHanded := false
      )
   )
   
   if (isEmptyHanded == true) then(
      variable(emptyMenuItem)
      emptyMenuItem := add menu item(curMenu)
      
      string from textbox(ITEM_MENU_STRING, ITEM_MENU_MESSAGES_TEXT_BOX, YOU_ARE_EMPTY_HANDED_MESSAGE)
      set menu item caption(emptyMenuItem, ITEM_MENU_STRING)
      
   )
   
   bring menu forward(curMenu)
end
Back to top
View user's profile Send private message
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Mon Jul 14, 2008 2:36 pm    Post subject: Reply with quote

Does the script set up the menu correctly for non-empty inventories? My first guess would be that you need to close the Main Menu when the script begins, because the Main Menu pauses gameplay (and scripts) by default. Other than that, everything seems okay on first read.

However, you probably want to be counting equipment towards your weight (and showing this to the player). So the command "inventory" might not be sufficient, and you may need a little more work in there.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Jul 15, 2008 2:36 am    Post subject: Reply with quote

You've put the lines
Code:
      variable(isEmptyHanded)
      isEmptyHanded := true
INSIDE your for loop.

As for the menu layering problem, I don't see any problem with your script or with the code in Game, and what's odd though is that new menus should be created on top of all open menus. What if you comment out the bringmenuforward line?
Check g_debug.txt: these menu commands will print an error there if there's a problem with your arguments.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Tue Jul 15, 2008 10:43 am    Post subject: Reply with quote

msw188 wrote:
Does the script set up the menu correctly for non-empty inventories? My first guess would be that you need to close the Main Menu when the script begins, because the Main Menu pauses gameplay (and scripts) by default. Other than that, everything seems okay on first read.

However, you probably want to be counting equipment towards your weight (and showing this to the player). So the command "inventory" might not be sufficient, and you may need a little more work in there.


Yes, it does set up the menu correctly for non-empty inventories. Keeping gameplay (and even other scripts) paused should be fine when the menu is open. I just want this menu to pop up on top of the main menu.

As far as the weight calculation goes, yeah, I know I need more work. I just wanted to get a custom inventory screen working before I got to that.

The Mad Cacti wrote:
You've put the lines

Code:
      variable(isEmptyHanded)
      isEmptyHanded := true


INSIDE your for loop.


Hah! Good catch. Thanks.

The Mad Cacti wrote:
As for the menu layering problem, I don't see any problem with your script or with the code in Game, and what's odd though is that new menus should be created on top of all open menus. What if you comment out the bringmenuforward line?
Check g_debug.txt: these menu commands will print an error there if there's a problem with your arguments.


The script originally was written without bringmenuforward, since I assumed a newly created menu would go on top by default. I only added that command in later since that didn't seem to be happening.

I cleared out g_debug.txt, started the game, immediately opened the custom item menu, closed it, and quit. Afterward, the contents of g_debug.txt were:

Playing game OHRogue.rpg ( ) 07-15-2008 14:39:35

So, it looks like I'm not creating any errors in the plotscript.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group