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

A beginner's question
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sat Jan 01, 2011 5:19 am    Post subject: A beginner's question Reply with quote

Hello everyone! Merry christmas and happy new year!

I've started to work on the menu of my Saiyuki Game after a big pause and to implement it, I've got to decrement a global variable

Would somoene know how to do that?

The global variable is named nb nikuman

Code:


  Global variable (58, nb nikuman)

set variable (nb nikuman, ???)




As always thanks a lot for your help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Jan 01, 2011 7:02 am    Post subject: Reply with quote

Happy New Year and Christmas!

To decrement by 5:

Code:
nb nikuman -= 5
OR
nb nikuman := nb nikuman -- 5
OR
decrement(nb nikuman, 5)
OR
set variable(nb nikuman, nb nikuman -- 5)

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sun Jan 02, 2011 11:48 am    Post subject: Help to switch menu Reply with quote

I have a little problem switching between the sub menu of my menu

When the player esc he/ she opens menu 6 (the main menu)
If she/he press esc, he/she can go back to the main screen

If the player presses space and if menu 6 is opened he can choose between


item
accessories
formation
status
technics
puzzle
save
quit

For each choice he runs a script and open a menu

item (=> item menu script runs open item menu (menu2))
accessories (=> accessories menu script runs =>open item menu (menu19))
formation
status
technics
puzzle
save
quit

My problem is the following : when my item menu script is launched the item menu opened) and when the player press esc one time he/she manages to get to the step before (when there's only the main menu launched) but if she/he press esc a second time the player won't go back to the main screen.

What is really strange is that when the first part goes fine until you run the menu script : the player press esc, opened the main menu (menu 6) go to the menu map. At that precise time if I press esc I go back to the play screen but if I press space and run the item menu script then it's over. It became impossible to go back to the play screen no matter how much I press esc to leave.

I think my problem comes from script resting.

Any advice is welcomed!
Happy new year 2011 everybody!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed Jan 05, 2011 8:48 am    Post subject: Reply with quote

By "back to the main screen" and "back to the play screen" do you mean exit the menu? You mentioned a "menu map": do you go to another map when opening the main menu?

Do you have a script listening for the ESC key (which launches the main menu)? If so, can you post it, and also the script that launches the item menu?

What bits do you have set on menu 6 and menu 2? Do they allow player control, scripts, and closing with ESC?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Wed Jan 05, 2011 9:31 am    Post subject: Here are the answers Reply with quote

The Mad Cacti wrote:
By "back to the main screen" and "back to the play screen" do you mean exit the menu?


Yes that's what I mean

[quote="The Mad Cacti] You mentioned a "menu map": do you go to another map when opening the main menu?
[/quote]

Yes I do! The main menu appear after the hero have been teleported to map 18

Do you have a script listening for the ESC key (which launches the main menu)? If so, can you post it, and also the script that launches the item menu?



Code:

#---------------------------------------------------------------------------
#Dans ce script on a le on-keypress script

plotscript, on keypress script, begin 

#pas de loop key:=true ici cela permet au menu de base d'apparaître


if (key is pressed(key: numlock)==true) then, begin # key is numlock: Pause

if (pauseisactive==false) then, begin
pause script
#PENSER A RAJOUTER DE QUOI EMPECHER LE CURSEUR DE BOUGER DANS LES
# MENUS PENDANT LA PAUSE
end, else, begin

#thus, pauseisactive must be true
unpaused script
end #end of the if (pause is active)
end #end for the if key is pressed


if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin

if (gamemenuisactive==false) then, begin
game menu
end, else, begin

#thus, game has not been launched
leave game menu
end #end of if (game menu is active)

end #end for the if key is pressed


end #end of the plotscript here
#------------------------------------------------------------------------------------
plotscript, game menu, begin

suspend npcs
suspend player #allows basic menu 0 not to appear

variable (handle)
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)

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:=0
wait (1)

handle:= open menu (6)
fade screen in
show map

gamemenuisactive:= true
wait (1)

#no resume player here 1rst part of the script
#no resume npcs


end #end of the script
#------------------------------------------------------------------------------------
plotscript, leave game menu, begin

while (gamemenuisactive) do, begin

switch (escape behaviour) do, begin
case (0) do, begin # leave menu just after launching

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)

hide string (8)
hide string (11)

teleport to map (YourM, YourX, YourY)
wait (3)

if (top menu ==true) then, begin
close menu (top menu) #menu 6 alone -> top menu is required
end, else, begin
wait (1) #do nothing menu already closed
end #end if top menu returns true

escape behaviour:= 0
wait (1)

show map
fade screen in
gamemenuisactive:= false #a laisser ici pour éviter de relancer le script trop de fois
wait (1)
resume npcs
resume player
end #end for the case


case (1) do, begin # go back to the main menu after leaving item menu
while (itemmenuisactive) do, begin
fade screen out (0,0,0)
resume box advance
wait for text box
variable (handle) #already defined : no need to add it variable needed to close the menu

handle:= find menu ID (2)
open menu (6) #main menu pops up
wait (3)
close menu (handle)

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)

itemmenuisactive:= false
wait(1)

resume npcs
resume player
fade screen in
end # end for the case
end #end for the while item menu

#case (1) do, begin # go back to the main menu after leaving item menu
#case (2) do, begin # go back to the main menu after leaving accessories menu
#case (3) do, begin # go back to the main menu after leaving formation menu
#case (4) do, begin # go back to the main menu after leaving status menu
#case (5) do, begin # go back to the main menu after leaving technics menu
#case (6) do, begin # go back to the main menu after save menu (= having saved the game)

case (7) do, begin # go back to the main menu after leaving the use item sub menu
fade screen out (0,0,0)
resume box advance
wait for text box
#variable (handle) #already defined : no need to add it variable needed to close the menu
handle:= find menu ID (8)
close menu (top menu)
wait (2)
open menu (2)#item menu pops up

$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

escape behaviour:= 1
wait (1)
resume npcs
resume player
fade screen in
end # end for the case

#case (8) do, begin # go back to the item sub menu after leaving the sort item sub sub menu
#case (9) do, begin # go back to the item sub menu after leaving the rare item sub sub menu

end #end for the switch

gamemenuisactive:=false
wait (1)
end #end while game menu is active

end #end of the script

#----------------------------------------------------
# item menu for the menu outside battle
plotscript, item menu, begin

suspend player
fade screen out (0,0,0)
hide string (11) # hide luck and yens infos not in status menu
hide string (8)
close menu (top menu) # close previous menu : main menu 6

$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

variable (handle)
open menu (2) #open item menu
handle:= find menu ID (2)
fade screen in

escape behaviour:=1 #gives correct escape behaviour
wait (1)
itemmenuisactive:=true
wait(1)

end #end for the plotscript
#------------------------------------------------------------------------------


Here are the bisets

menu 2 (item menu)
bitsets on -> allow gameplay and scripts
-> no box
-> cancel button don't close menu

menu 6 (main menu)
bitsets on -> allow gameplay and scripts
-> suspend gameplay even if allowed
-> no box
-> cancel button don't close menu

The basic idea is to use the run-script ability of the menu to make run the menu and sub menu instead of recording the key the player presses and re-implementing everything (but I may be got the wrong idea...)

Thanks for your concern and your help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Jan 06, 2011 6:50 pm    Post subject: Reply with quote

Code:
if (top menu ==true) then, begin
Should be
Code:
if (top menu) then, begin
You see, the fixed version is actually equivalent to "if (top menu <> false) then, begin" but NOT to what you wrote.

Some other comments about your scripts:

In the case(1) of "leave game menu", you have
Code:
resume box advance
wait for text box

but it looks like there isn't actually a textbox being displayed.

Also, your scripts contain a lot of unnecessary wait commands. I'm worried that if you press Esc at the wrong time, like while "item menu" is running, then the on-keypress script will interfere with the running script and break it. It would be a good idea to cause the on-keypress to do nothing, by adding a check to it. That's easier than figuring out how to make sure that it's safe to run them both at once:

Code:
global variable (100, disable onkeypress)

plotscript, on keypress script, begin
  if (disable onkeypress) then (exit script)
  ...
end

plotscript, game menu, begin
  disable onkeypress := true
  ...
  disable onkeypress := false
end

#and so on, for other scripts.


Your script "item menu" has the same name as a script command. In the future HSpeak will throw an error about this, and you will have to rename your script.

Also, you normally want to place "wait (1)" before "fade screen in"
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sat Jan 15, 2011 6:26 am    Post subject: Some problems with my leave game script Reply with quote

I've worked on the leave game menu script

Code:

plotscript, leave game menu, begin

while (gamemenuisactive) do, begin

disable onkeypress := true

switch (escape behaviour) do, begin
case (0) do, begin # leave menu just after launching
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)

hide string (8)
hide string (11)

teleport to map (YourM, YourX, YourY)
wait (3)
close menu (top menu)

escape behaviour:= 0
wait (1)
show map
fade screen in
resume npcs
resume player
end #end for the case


case (1) do, begin # go back to the main menu after leaving item menu
fade screen out (0,0,0)
resume box advance
wait for text box
variable (handle) #already defined : no need to add it variable needed to close the menu

handle:= find menu ID (2)
open menu (6) #main menu pops up
wait (3)
close menu (handle)

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)

resume npcs
resume player
fade screen in

end # end for the case

#case (1) do, begin # go back to the main menu after leaving item menu
#case (2) do, begin # go back to the main menu after leaving accessories menu
#case (3) do, begin # go back to the main menu after leaving formation menu
#case (4) do, begin # go back to the main menu after leaving status menu
#case (5) do, begin # go back to the main menu after leaving technics menu
#case (6) do, begin # go back to the main menu after save menu (= having saved the game)

case (7) do, begin # go back to the main menu after leaving the use item menu
fade screen out (0,0,0)
resume box advance
wait for text box
#variable (handle) #already defined : no need to add it variable needed to close the menu
handle:= find menu ID (8)
close menu (top menu)
wait (2)
open menu (2)#item menu pops up

$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

escape behaviour:= 1
wait (1)
resume npcs
resume player
fade screen in
end # end for the case

#case (8) do, begin # go back to the item sub menu after leaving the sort item sub sub menu
#case (9) do, begin # go back to the item sub menu after leaving the rare item sub sub menu

end #end for the switch
end #end for the while game menu is active

gamemenuisactive:= false
wait (1)
disable onkeypress := false

end #end of the script
#----------------------------------------------------------------------------------



I think the script works well because it starts to make appear the previous menu state but before the end, Hspeak complains about
"invalid menu handle -1" call chain current script last onkeeyispressed
-> leave game menu

The problem may comes from the bad use of Top menu

Could you confirm that top menu should be used when there's only one menu poped up on the screen ?

What do you think about including the lines with the variable disable onkeypress inside the cases of the switch command (see above)

I've tried to see what happen when I press esc as I've launched item sub menu and it appears that the script runs and try to go back to leave the map and the game as if I've pressed on esc several times. (I was in a sub menu and just wanted to go back to the previous menu)

Code:

case (7) do, begin # go back to the main menu after leaving the use item
menu

disable onkeypress := true
fade screen out (0,0,0)
resume box advance
wait for text box
#variable (handle) #already defined : no need to add it variable needed to close the menu
handle:= find menu ID (8)
close menu (top menu)
wait (2)
open menu (2)#item menu pops up

$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

escape behaviour:= 1
wait (1)
resume npcs
resume player
fade screen in

disable onkeypress := false

end # end for the case


Thanks for your help and advice!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Jan 18, 2011 2:56 am    Post subject: Re: Some problems with my leave game script Reply with quote

Quote:
I think the script works well because it starts to make appear the previous menu state but before the end, Hspeak complains about
"invalid menu handle -1" call chain current script last onkeeyispressed
-> leave game menu

The problem may comes from the bad use of Top menu

Could you confirm that top menu should be used when there's only one menu poped up on the screen ?


There are three places in "leave game menu" where you use "close menu". I don't know which one is throwing the error, but
Code:
close menu (top menu)

will throw an error only if there is no menu open, and
Code:
handle:= find menu ID (2)
open menu (6) #main menu pops up
wait (3)
close menu (handle)

will throw an error if menu 2 was not open.

Also, I notice that you have several random extra lines like
Code:
handle:= find menu ID (8)

which do nothing.

Quote:
What do you think about including the lines with the variable disable onkeypress inside the cases of the switch command (see above)

That shouldn't make any difference. I don't see why you would want to, though.

Quote:

I've tried to see what happen when I press esc as I've launched item sub menu and it appears that the script runs and try to go back to leave the map and the game as if I've pressed on esc several times. (I was in a sub menu and just wanted to go back to the previous menu)


Does that happen only if you press Esc while the item menu script is still setting up the menu?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Fri Jan 21, 2011 11:24 pm    Post subject: It's better now! Reply with quote

I still have some little with the menu commands but it's better now.

I would like to check if a menu (let's say menu 2) is opened or not.
If it is opened, I would like to close it.

Could you please help me to say this in plotscript language?

Thanks a lot for your help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Jan 25, 2011 4:11 am    Post subject: Reply with quote

Easy!

Code:

variable (handle)
handle := find menu id (2)
if (handle) then (close menu (handle))

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Wed Jan 26, 2011 1:11 am    Post subject: When I test my script, menu 8 does not disappear Reply with quote

When I test my script, menu 8 does not disappear whereas the others menu do. I wonder why

Here are the bitsets activated

allow gameplay and script
no box button does not close menu (I use plotscripting)
advance text box when close menu

I didn't modified the bitsets through plotscripting. Any ideas or advice about what I could do?

May be my script end too soon...
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Jan 27, 2011 4:04 am    Post subject: Reply with quote

Which part of the script is the problem? Where are you trying to close menu 8? I can't work that out, and anyway you said that you had modified the scripts.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Fri Jan 28, 2011 12:10 am    Post subject: After some checks Reply with quote

After some check I've discovered that the menu open because I wrongly used the open menu command.

I've improved the article about door linking. Fell free to correct it if there are still errors.

http://hamsterrepublic.com/ohrrpgce/How_do_I_change_door_linking_.html
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Jan 28, 2011 5:35 am    Post subject: Reply with quote

OK, good to hear.

Thanks. I'll read through the article later and make improvements.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
bis_senchi




Joined: 08 Jun 2004
Posts: 460
Location: Reims, France

PostPosted: Sat Jan 29, 2011 12:42 am    Post subject: Hello again! Reply with quote

I've made the first part and will make the second one with fake doors when I'll have free time.

I came up with another problem

I need to make appear text that will be updated on my menu. I intended first to use strings with the s{ } but it didn't work.

So I though about hero's name because the h{ } variable works with menu . Furthermore, there's plenty of free hero slots that I can use.

So here's the problem. Hero 11 is named unequipped.

I would like

->first to change the name of this hero to "gloves" THROUGH plotscriting. Nothing should appear on screen. Could you please show me with an exemple how to that ?

-> then save the new name so that when the player comes back, he sees gloves and not unequipped anymore. I think I'll need set variable and get hero name but I don't see very well how to combine them

Thanks for your help and good luck making your games!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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