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

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Dec 27, 2009 6:39 am Post subject: Help with key behavior re-implementation! |
|
|
Hello since a long time (6 months) !
I'm working on the main Menu for my Saiyuki Game. I've implemented my own using the edit menu function of the OHRRPGCE
Code: |
#---------------------------------------------------------------------------
#Dans ce script on a le on-keypress script
plotscript, on keypress 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
if (check tag (tag: battle)==on) then, begin #menu is unactivated while battles only
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 tag
end #end for the case
case (1) do, begin #leave status menu
fade screen out (0,0,0)
resume box advance
wait for text box
variable (handle)
handle:=open menu (6)#main menu pops up
hide string (1) #hide menu name
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, 147, 18)
show string at (11, 147, 31)
escape behaviour:=0
wait (1)
fade screen in
end #end for the case
case (2) do, begin #leave items menu
wait (1)
end #end for the case
case (3) do, begin #leave menu and go back to the game
leave game menu
end #end for the case
end #end of the script
#-----------------------------------------------------------------------
plotscript, leave game menu, begin
suspend player
show backdrop (0) #show absolutely nothing
fade screen out
set hero picture (me, MyPicSet)
if (hero by slot (1) <> -1) then, begin # if slot (1) is occupied
set hero picture (1, heropic1)
end
if (hero by slot (2) <> -1) then, begin # if slot (2) is occupied
set hero picture (2, heropic2)
end
if (hero by slot (3) <>- 1) then, begin # if slot (3) is occupied
set hero picture (3, heropic3)
end
camera follows hero (me)
game menu active:= false #make sure player keeps suspended
wait (1)
hide string (8)
hide string (11)
escape behaviour:=0 #gives normal behaviour
wait (1)
teleport to map (YourM, YourX, YourY)
variable (handle)
handle:=close menu (6)
fade screen in
show map
resume player
end #end for the script
#------------------------------------------------------------------------------
|
My problem is the following : I have problems to re-implement the esc key.
When I first press esc everything goes fine but when I choose quit (which launches the leave game menu script) All the code runs well but when the script runs my main menu (menu 6) is still on screen whereas I pressed esc.
I would like to make menu 6 disappear from the screen using plotscripting. How can I do that ?
Thanks in advance for the help! _________________ It's time to make games! |
|
Back to top |
|
 |
Guest
|
Posted: Sun Dec 27, 2009 1:34 pm Post subject: |
|
|
On a quick read, I'm guessing the problem is in the lines near the end:
Code: | variable (handle)
handle:=close menu (6) |
The command "close menu" cannot be told the number of a menu to close. If the main menu is the only menu that is open at this moment, I would change these two lines to one line:
Code: | close menu (top menu) |
On the other hand, if there is a chance that there will be multiple menues open at once when the player presses Esc, we might need a little bit more complicated machinery. Let us know! |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Thu Dec 31, 2009 9:42 am Post subject: help with the sub-menu! |
|
|
Finally I managed to reimplement the esc key using the autorun map script and a global variable.
But I now have another problem with the sub-menu
Code: |
#------------------------------------------------------------------------------
# extract only of the onkeypress script
plotscript, my on keypressscript, begin
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin
while(key is pressed(key:esc), xor, key is pressed(key:alt)) do, begin
switch (escape behaviour) do, begin
case (0) do, begin
if (see main menu ==false) then, begin
game menu
end, else, begin
leave game menu
end #end for the (see main menu)
end #end for the case
case (1) do, begin #leave status menu
fade screen out (0,0,0)
resume box advance
wait for text box
variable (handle)
handle:=open menu (6)#main menu pops up
hide string (1) #hide menu name
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, 147, 18)
show string at (11, 147, 31)
escape behaviour:=0
wait (1)
fade screen in
end #end for the case
case (2) do, begin #leave items menu
wait (1)
end #end for the case
case (3) do, begin #leave status menu
leave status menu
end #end for the case
end #end for the switch
end #end for the while
end #end for if key is pressed
end #end of the plotscript here
#---------------------------------------------------------------
# autorun map menu map
plotscript, autorun map18, begin
while (game menu active==true) do, begin #make sure player keeps suspended
suspend player
end
while (see main menu==true)do, begin
leave game menu
end
end #end for the script
#------------------------------------------------------------------------------
plotscript, leave game menu, begin
suspend player
show backdrop (0) #show absolutely nothing
fade screen out
set hero picture (me, MyPicSet)
if (hero by slot (1) <> -1) then, begin # if slot (1) is occupied
set hero picture (1, heropic1)
end
if (hero by slot (2) <> -1) then, begin # if slot (2) is occupied
set hero picture (2, heropic2)
end
if (hero by slot (3) <>- 1) then, begin # if slot (3) is occupied
set hero picture (3, heropic3)
end
camera follows hero (me)
game menu active:= false #make sure player keeps suspended
wait (1)
hide string (8)
hide string (11)
teleport to map (YourM, YourX, YourY)
close menu (top menu) #close previous menu
escape behaviour:=0
wait (1)
fade screen in
show map
see main menu:=false
wait (1) #Wait 1 is very important. Do not delete the command
resume player
end #end for the script
#------------------------------------------------------------------------------
# item menu
plotscript, item menu, begin
fade screen out (0,0,0)
escape behaviour:=2
hide string (11) # hide luck and yens infos not in status menu
hide string (8)
variable (handle)
handle:= find menu ID (6) #main menu = menu nb 6
close menu (handle)
#increment (escape behaviour, 2)# adapt escape behaviour for leaving menu
$0="Items"
string from textbox (1, 53, 2) #text box 53 L2 is for menu names
show string at (1, 17, 21) # Sub menu name location
handle:= find menu ID (2) # items menu = menu 2
open menu (2) #open item menu
wait (5) #make sure menu already poped up when screen goes back to normal
fade screen in
handle:= find menu ID (2)
close menu (handle)
handle:= find menu ID (6)
open menu (handle)
#escape behaviour:=0 # give back basic behaviour
#wait (1)
end #end for the plotscript
|
I'm now working on re-implementing the esc function to get back from a
sub-menu to the main menu.
But when I press esc the item menu pops up and some seconds after custom basic menu (menu 0) pops up
Could some give me advice about what could be wrong in the code?
As always thanks a lot for the help! _________________ It's time to make games! |
|
Back to top |
|
 |
Rimudora Psychopath yandere Halloween 2006 Creativity Winner


Joined: 26 May 2005 Posts: 335
|
Posted: Thu Dec 31, 2009 10:02 am Post subject: |
|
|
I think it might be this part of the code:
Code: | handle:= find menu ID (6)
open menu (handle) |
Close menu takes a menu handle, but open menu takes the menu ID, so I think you're supposed to use something like 'open menu(6)'.
As it is, I'm guessing that handle is defaulting to 0 or -1 when it can't find an existing copy of menu 6, which makes menu 0 pop up with the next line of code. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Jan 02, 2010 12:35 am Post subject: Thanks! It's a bit better now! |
|
|
I re-implemented the quit function of the menu. I've made some searches in the dictionnary and the command "set menu bit" appeared to be what I need when I read the plotscript dictionnary I see
Plotscript dictionnary wrote: |
set menu bit(menu handle, bit, value)
Given a menu handle (for example, the one returned by top menu), and bit number bit, Set the bitset is ON or OFF depending on value. You can use constants for the bit bit number in the form of menubit:translucent box menubit:never show scrollbar menubit:allow gameplay menubit:suspend player even if gameplay allowed menubit:no box menubit:no close menubit:no controls menubit:no close menubit:no controls menubit:prevent main menu |
I think that there is an error and that a part of the definition have been correcter several times. menubit: no close appears several times whereas it should Could someone who knows who is in charge of the plotscript dictionnary send an email or a mp so that it can be corrected ?
Happy new year 2010 to everyone and good luck all in making your games! _________________ It's time to make games! |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Jan 02, 2010 7:22 am Post subject: Re: Thanks! It's a bit better now! |
|
|
bis_senchi wrote: | I think that there is an error and that a part of the definition have been correcter several times. menubit: no close appears several times whereas it should Could someone who knows who is in charge of the plotscript dictionnary send an email or a mp so that it can be corrected ?
Happy new year 2010 to everyone and good luck all in making your games! |
Thanks, I've fixed it. Happy 2010 _________________ "It is so great it is insanely great." |
|
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
|