 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun May 03, 2009 1:13 am Post subject: Help with my new menu |
|
|
I will put apart my yugioh menu for now. I will ask again for an answer when time will come
I'm working on my saiyuki menu using the menu function of custom.exe
My customized main menu is menu 6.
As I could close the one, I choosed to use the biset "no player control" and started to re-implement the key behaviour
I've choosen the down arrow key to start.
My problem is the following : when I press the down arrow key the cursor doesn't move
Could somoene tell me if the commands I have choosen are the right one
and how to combine them?
The new main menu pops up thanks to open menu. Indeed, I've also checked that the tag is on as the menu pops up!
Code: |
plotscript, onkeypress2, begin
if (key is pressed (key: down),and, check tag (tag: game menu launched)) then, begin
switch (down arrow behaviour) do, begin
case (2) do, begin #behaviour while menu is launched
if (selected menu item(6)== 0) then, begin #if item is selected then the down arrow key chooses accessories for next menu item
next menu item(6, 1)
end, else, begin
if (selected menu item(6)==1) then, begin #if accessories is selected then the down arrow key chooses statuts for next menu item
next menu item(6, 2)
end, else, begin
if (selected menu item(6)==2) then, begin #if statuts is selected then the down arrow key chooses technics for next menu item
next menu item(6, 3)
end, else, begin
if (selected menu item(6)== 3) then, begin #if technics is selected then the down arrow key chooses Save for next menu item
next menu item(6, 4)
end, else, begin
if (selected menu item(6)== 4) then, begin #if Save is selected then the down arrow key chooses Quit for next menu item
next menu item(6, 5)
end, else, begin
if (selected menu item(6)== 5) then, begin #if Quit is selected then the down arrow key chooses Leave Game for next menu item
next menu item(6, 6)
end, else, begin
if (selected menu item(6)== 6) then, begin #if Leave Game is selected then the down arrow key chooses items for next menu item
next menu item(6, 0)
end #ends for the if menu items
end
end
end
end
end
end
end #end for the case
end #end for the switch
end #end for the if key is pressed
end #end for the script
#------------------------------------------------------------------------------
|
As always thank you very very much for your help! _________________ It's time to make games!
Last edited by bis_senchi on Mon May 04, 2009 9:06 pm; edited 1 time in total |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon May 04, 2009 7:34 am Post subject: |
|
|
Code: |
plotscript, onkeypress2, begin
if (key is pressed (key: down),and, check tag (tag: game menu launched)) then, begin
switch (selected menu item(6)) do(
case(0) do( #if item is selected then the down arrow key chooses accessories for next menu item
next menu item(6, 1)
end, else, begin
if (selected menu item(6)==1) then, begin #if accessories is selected then the down arrow key chooses statuts for next menu item
next menu item(6, 2)
end, else, begin
if (selected menu item(6)==2) then, begin #if statuts is selected then the down arrow key chooses technics for next menu item
next menu item(6, 3)
end, else, begin
if (selected menu item(6)== 3) then, begin #if technics is selected then the down arrow key chooses Save for next menu item
next menu item(6, 4)
end, else, begin
if (selected menu item(6)== 4) then, begin #if Save is selected then the down arrow key chooses Quit for next menu item
next menu item(6, 5)
end, else, begin
if (selected menu item(6)== 5) then, begin #if Quit is selected then the down arrow key chooses Leave Game for next menu item
next menu item(6, 6)
end, else, begin
if (selected menu item(6)== 6) then, begin #if Leave Game is selected then the down arrow key chooses items for next menu item
next menu item(6, 0)
end #ends for the if menu items
end
end
end
end
end
end
end #end for the case
end #end for the switch
end #end for the if key is pressed
end #end for the script
#------------------------------------------------------------------------------
|
Okay. I see you keep using "6" as the menu handle. I don't know where you got the number six, but you never use a number for a handle. You probably wanted "selected menu item", not "6"
Second, you are using a "switch" statement, but you have no "case" statements inside it, just a bunch of if/then/else.
I can help you with this, but I am not sure what you are trying to do here.
Quote: |
As I could close the one, I choosed to use the biset "no player control" and started to re-implement the key behaviour
|
Why are you using the "no player control of menu"? What is the reason for this? Why reinvent the wheel? |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Mon May 04, 2009 4:58 pm Post subject: |
|
|
It may be helpful to you, Bis, to know that any menu you customize can be set to disallow the player cancelling with the ESC key. It's in one of the 'menu bitsets' options, I think. _________________ 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 |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon May 04, 2009 9:13 pm Post subject: selected menu is may be not what I need afterall |
|
|
I've partially corrected the code. I'm using switch and case so that the code keeps clean if I implement a mini game that uses arrows later.
The figure 6 is the number of the menu. I'm using figures also for save slots
For example :
Code: |
if (selected menu item(6)==1) then, begin #if menu item in slot1 of menu 6 is already selected then...
|
But I may be wrong. At the beginning I was doing all this because I have problems to close a menu through plotscripting. The bitset "close menu on box advance is not very useful...
If you any suggestions, I would be glad to hear them! _________________ It's time to make games! |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue May 05, 2009 8:23 am Post subject: Re: selected menu is may be not what I need afterall |
|
|
bis_senchi wrote: |
The figure 6 is the number of the menu. I'm using figures also for save slots
For example :
Code: |
if (selected menu item(6)==1) then, begin #if menu item in slot1 of menu 6 is already selected then...
|
|
That will not work.
It is very important to understand the difference between menu ID numbers, menu handles, and menu item handles. All three are totally different things, and none of them are interchangeable.
There are exactly two commands that can use menu ID numbers:
open menu and find menu
These are the only two commands where your menu ID number 6 will work!
All the other commands that manipulate a whole menu need a menu handle. You get your menu handle from the open menu command.
Code: |
variable(handle)
handle := open menu(6)
|
Just because the menu ID number is 6, that does not mean that the menu handle will also be six. The menu handle will be some unknown number that is assigned when the menu is open. It could even be different each time you run your game, or it could even be different for different times that you open your menu in the same play session.
That is why you need to store the return value from "open menu" in a variable so you can use it later in the script. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu May 07, 2009 7:01 am Post subject: After some reflexion... |
|
|
I think that I won't use the bitset " No player control of the menu"
Code: |
plotscript, onkeypress script, begin
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin
switch (escape behaviour) do, begin
case (0) do, begin #basic behaviour reinterpret the esc key
suspend player
wait(1)
resume player
end, else, begin #if we're outside battle then we need the game menu
game menu
end #end for the case
case (1) do, begin #leave menu pressing esc
end #end for the case
end #end of the script
#----------------------------------------------------------
# lance le menu du jeu
plotscript, game menu, begin
suspend player
suspend npcs
set variable (YourMoney, party money) # cherche combien on a d'argent
fade screen out (0, 0, 0)
show backdrop (0)
set variable (YourM,current map) #permet d'enregistrer notre position dans le jeu
set variable (YourX,herox(me))
set variable (YourY,heroy(me))
set variable (MyPicSet, get hero picture(me)) #permet d'enregistrer notre apparence
set variable (heropic1, get hero picture(1))
set variable (heropic2, get hero picture(2))
set variable (heropic3, get hero picture(3))
camera follows npc (0)
teleport to map (18, 2, 4)
game menu active:= true #make sure player keeps suspended
wait (1)
set hero picture (me, 0) # hero 0 became invisible by default
if (hero by slot (1) <> -1) then, begin # if slot (1) is occupied
set hero picture (1, 0)
end
if (hero by slot (2) <> -1) then, begin # if slot (2) is occupied
set hero picture (2, 0)
end
if (hero by slot (3) <> -1) then, begin # if slot (3) is occupied
set hero picture (3, 0)
end
$20= "P.Good" #chance par défaut enlevé plus tard
# string 8 et 11 servent déjà à afficher la magie dans les combats pour hakkai et sanzo réutilisés
# pour la chance et la magie dans le menu!
string from textbox (8, 53, 0) #text box 53 L0 -> chance
string from text box (11,53, 1) #text box 53 L1 -> money
show string at (8, 167, 18)
show string at (11, 167, 28)
escape behaviour:= 3 # allows to leave if esc is pressed right away
wait (1)
set tag (tag : game menu launched, on)
open menu (6)
fade screen in
show map
resume player
resume npcs
end #end of plotscript
|
My question is the following: with the help of the switch command what should I put in case to make close my menu using esc?
Thanks for the help! _________________ It's time to make games! |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu May 07, 2009 8:38 am Post subject: Re: After some reflexion... |
|
|
bis_senchi wrote: | My question is the following: with the help of the switch command what should I put in case to make close my menu using esc?
Thanks for the help! |
ESC should close the menu automatically even without a plotscript.
Did you turn on the bitset that prevents ESC from closing the menu? |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu May 07, 2009 9:11 pm Post subject: I didn't turn the bitset on |
|
|
Yes I didn't turn it on. What I would like to do in fact is closing the menu using esc but THROUGH plotscripting. Is there any way to do that? _________________ It's time to make games! |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon May 11, 2009 9:36 pm Post subject: So? Any answer? |
|
|
So? Could somoene help me and explain how
to close a menu using plotscripting?
I already know I have to use the command close menu but are there other pieces of information I need to know? Like bitsets that may be activated fr example... _________________ It's time to make games! |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue May 12, 2009 8:35 pm Post subject: |
|
|
I'm sorry Bis, but right now based on everything you've said I really can't think of any help to offer other than to get rid of the plotscripting altogether and just turn on the bitset "ESC doesn't close the menu" and let the player have full control of all the menues. Why should a plotscript control the arrow keys when a menu is up? If you want special plotscripting for special movement for a mini-game, that should be separate from any time a menu is present (menues pause whatever is going on in the game behind them). In other words, have a plotscript that controls movement, but do NOT have a plotscript to control the menu.
The only issue then is, "how does the player close the menu if ESC doesn't work?" But this is simple. Make one of the menu-choices call a very simple plotscript which does nothing but close the top menu. Then the player needs to pick this menu-choice to close the menu. _________________ 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 |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu May 14, 2009 6:24 am Post subject: how to use "close menu" |
|
|
Well if possible I would like to use esc. Anyway, when I test I make
launch a menu using open menu.
When I insert the line "close menu" later it doesn't work. The only way to close the menu is to press esc after the script ends.
So? Can somoene explain the reason of that?
Code: |
script, test menu, begin
suspend player
variable (handle)
handle:= open menu (5)
wait for key (key:s)
handle:= close menu (5)
resume player
end #end of the script
|
_________________ It's time to make games! |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu May 14, 2009 8:52 am Post subject: Re: how to use "close menu" |
|
|
Remember that the menu ID number only works for "open menu" and "find menu" all other menu commands use handles so what you want is this:
Code: |
script, test menu, begin
suspend player
variable (handle)
handle:= open menu (5)
wait for key (key:s)
close menu (handle)
resume player
end #end of the script
|
|
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Mon May 18, 2009 8:25 am Post subject: thanks but could you help me with this? |
|
|
I also would like to use the s key to open and close the menu items.
How am I supposed to do?
I know that I need the handle variable but I don't know with what command to combine it.
Code: |
script, test menu, begin
suspend player
variable (handle)
handle:= open menu (5)
wait for key (key:s)
#???? what should I put here?
close menu (handle)
resume player
end #end of the script
|
Thanks in advance for the help! _________________ It's time to make games! |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue May 19, 2009 8:05 am Post subject: |
|
|
What do you want to do? Close the menu when the player presses s? That is exactly what the script you just posted should do. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Guest
|
Posted: Tue May 19, 2009 9:22 am Post subject: |
|
|
If you are trying to activate menu items with s (instead of enter or space or ctrl) then... Hmmm.
You know, I think we really need a command like "use menu item(menu item handle)" That seems to be conspicuously missing. |
|
Back to top |
|
 |
|
|
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
|