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

Problem with the load menu command
Goto page Previous  1, 2, 3  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 Jul 15, 2006 10:54 pm    Post subject: And once more... Reply with quote

So I just need to put set keypress script (48 ) at the end of the script? Oookay...

I've posted this because I wanted to be sure that it was the good path to follow.

Well It seems that I should be more careful writing the scripts It would prevent me posting useless questions... Anyway thanks the same.

Anyway, here is a rather challenging question this time: when I'm using the load menu command it appears that I can't use the "new game" option. It is due to the fact that the "new game" special script is already used for the game pre loads.

I would like my intro script to start when the player choose "new game"
Would somoene had any idea on how to do this? (and if it is not possible could we know why?)

May be scripts changes through strings would be helpful.

As always thanks very much for the help.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Sat Jul 15, 2006 11:07 pm    Post subject: Reply with quote

Hmm, in this case, you'll need to do things manually... I know, I know... but, not much you can do about it...

Code:
#this is the new game script
script, new-game, begin
  variable(s)

  #do other stuff here

  s:= load menu(false) #don't actually do anything
  if(s >> 0) then, begin
    load from slot(slot)
    exit script #don't do anything else
  end

  if(s == -1) then, begin
    game over #they chose quit
  end

  if(s == 0) then, begin
    intro #start the real new game
  end
end

#this is what would normally be the new game script
script, intro, begin
  #stuff
end


As this stands, I'll assume that you're doing more stuff before the load menu should show up, so put that in where I said "#do other stuff here"
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
bis_senchi




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

PostPosted: Sun Jul 16, 2006 10:44 pm    Post subject: Thanks a million Reply with quote

Mike Caron wrote:
Quote:
As this stands, I'll assume that you're doing more stuff before the load menu should show up, so put that in where I said "#do other stuff here"


You assume perfectly right!
Thanks a million! It's exactly what I needed. Raspberry! Raspberry!

And as you may get used to. Guess what??? I hav another question (incredible isn't it?) How can somoene ask so many plotscripting questions?

I also ask it to myself sometimes ... Ha ha ha!
Anyway here is my new problem which shall be easy solved

Code:


#---------------------------------------------------------------------------

define script, intro stuff, begin

suspend player
suspend npcs

 destroy Npc (23)
 wait for Npc (23)
 walk hero to X (me, 73)
 wait for hero (me)
 walk hero to Y (me, 79)
 wait for hero (me)
 walk hero to X (me, 77)
 wait for hero (me) 
 set hero direction (me, north)
 wait for hero (me)

 create NPC (17, 77, 79)
 alter NPC (17, NPCstat:picture, 81)
 alter NPC (17, NPCstat:palette, 8)
 wait for NPC (17)

 set NPC speed (17, 2)
 wait for NPC (17)
 walk NPC to X (17, 80)
 wait for NPC (17)
 walk NPC to Y (17, 80)
 wait for NPC (17)
 set Npc direction (17, north)
 wait for NPC (17)

 create NPC (13, 77, 79)
 alter NPC (13, NPCstat:picture, 50)
 alter NPC (13, NPCstat:palette, 26) 
 wait for NPC (13)

 variable (Jupiter, Mercury) 
 Jupiter:=Npc reference (17)
 Mercury:=Npc reference (13)
 
 set NPC speed (Mercury, 2)
 wait for NPC (Mercury)
 walk NPC to X (Mercury, 76)
 wait for NPC (Mercury)
 walk NPC to Y (Mercury, 80)
 wait for NPC (Mercury)
 set Npc direction (Mercury, north)
 wait for NPC (Mercury)


resume player
resume npcs
end #end of the plotcript

#---------------------------------------------------------------------------



I would like the script you can see above to stop and launch another script "if the player press any key".

My problem is the following I don't see how to combine the if key is pressed and wait for key command so that I come to this.

Any suggestions are welcome!
As always thanks very much for the help!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Mon Jul 17, 2006 11:45 am    Post subject: Reply with quote

Well, I'll reply with a script:

Code:
define script(autonumber, wait for scancode, 1, 0)

script, wait for scancode, key, begin
  while(key is pressed(key)==false) do (wait(1))
end


Technically, this isn't perfect, as it is not implemented in the same way as all the other "wait for..." commands (which actually stop the script interpreter). But, for our purposes, this will wait until the player presses a specific key. So, you can use it like this:

Code:
suspend box advance

show text box(34) #"Press 'P'!"

wait for scancode(key:P)

advance text box


Hope this helps... some more...

EDIT: Ok, scratch that. I actually implemented a plotscripting command. It'll be in the nightly soon, although I can't guarantee that it'll work (since I, er, didn't test it. But, I'd have to make a whole new game, write a plotscript, make text boxes, blah blah blah. Just let me know if it works for you, tommorow.)
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
bis_senchi




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

PostPosted: Fri Jul 28, 2006 11:44 pm    Post subject: I'm back... from vacation Reply with quote

Finally I'm back from vacation! I'm ready to ask new questions!

Thanks once more to Mike Caron for answering!

Here is a new (little) problem. When I run the following script, the reset palette command runs before the teleport to map command. What is very strange is that sometimes it does not. (=The script runs exactly as it should)

It was as if the fade screen out and tweak palette were useless. Could somoene help me to change that?

Code:

#The script allows me to go where I was

script, go back from the HQ, begin

suspend player
suspend Npcs   
 
  if (check tag(tag: go back to party)==ON)
  then, begin
  fade screen out (63, 63, 63)       
  tweak palette (63,63,63)
  teleport to map (YourM, YourX, YourY)
  reset palette
  fade screen in   
 
  end #end of the of check tag

Resume player
Resume Npcs
end


As always, thanks very much for the help!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bis_senchi




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

PostPosted: Wed Aug 02, 2006 11:37 pm    Post subject: And once more... Reply with quote

I've managed to get rid of my problem with the reset palette command. Sorry for posting once more a useless script.

I'm now working on a password listener script inspired from Moogle1's script library. I had started to worked on it a rather long time ago when
there was a help me message board ...

First could somoene confirm me that the code is "rather" clean?
Any improvement suggestions are welcomed

Code:


define script (76,reset code, none)

define script (autonumber,check for finished codes,none)
define script (autonumber,go to listen for code, none)
define script (autonumber,add this key,1,0)


  Global variable (15, enter hq code)
  Global variable (16, L1)
  Global variable (17, L2)
  Global variable (18, L3)
  Global variable (19, L4)
  Global variable (20, nextletter)


#---------------------------------------------------------------------------
script,check for finished codes,begin
  if(L1==key:S,and,L2==key:P,and,L3==key:A,and,L4==key:M) then,begin
     reset code
     # trigger the magical SPAM password!
     show text box (370)
    wait for text box
  end
  if(L1==key:Q,and,L2==key:U,and,L3==key:I,and,L4==key:T) then,begin
     reset code
     # end the game
     game over
  end
end

#---------------------------------------------------------------------------
 script,add this key,key,begin
 
  if (key==Key:Backspace) then,begin
    # if backspace is pressed, reset the code
    reset code

  end,else,begin
    # any other key is recorded
    increment(nextletter)
    if (nextletter==1) then,begin
      L1:=key
     show text box (437)
     wait for text box    
    
    end,else,begin
      if (nextletter==2) then,begin
        L2:=key
      show text box (352)
      wait for text box
      
      end,else,begin
        if (nextletter==3) then,begin
          L3:=key
        show text box (353)
        wait for text box
       
        end,else,begin
          if (nextletter==4) then,begin
            L4:=key
         show text box (354)
         wait for text box
         
        end,else,begin
            # too many keys pressed, start again
            reset code
          end
        end
      end
    end
  end
  show value (nextletter)

end
#---------------------------------------------------------------------------
#script qui fait redemarrer le code
script, reset code, begin

  nextletter:=0
  L1:=0 
  L2:=0
  L3:=0
  L4:=0
 
end# end of the plotscript
#---------------------------------------------------------------------------
# on-keypress script
script, go to listen for code, begin

if (check tag (tag: enter code)==ON) then, begin
enter hq code:= true

while (enter hq code) do, begin
  variable(key)
  for (key,2,57) do, begin
    # check all scancodes from "1" to SPACE
    if (key is pressed(key)) then,begin
      add this key(key)
    end
 
end #end of the while command 

end
check for finished codes

enter hq code:= false
wait (1)
end, else, begin

wait (1)
end

end # end of the plotscript

#---------------------------------------------------------------------------
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 Aug 05, 2006 2:34 am    Post subject: Reply with quote

That looks alot cleaner, but there are still some problems in indentation. Here is goto listen for code with consistent indentation:


Code:
script, go to listen for code, begin

  if (check tag (tag: enter code)==ON) then, begin
    enter hq code:= true

    while (enter hq code) do, begin
      variable(key)
      for (key,2,57) do, begin
        # check all scancodes from "1" to SPACE
        if (key is pressed(key)) then,begin
          add this key(key)
        end
      end #end of the while command

    end
    check for finished codes

    enter hq code:= false
    wait (1)
  end, else, begin
    wait (1)
  end

end # end of the plotscript


You can see "#end of the while command" is in the wrong place!


You shouldn't call wait for text box after all the showtextbox commands. It will pause the script until the player presses Space, Enter or Ctrl.

Next, you will want a wait(1) command in the while loop in gotolistenforcode. Also, using keyval instead of keyispressed might be better. This stops you from accidentally adding a key multiple times if you press it too long. Don't worry about his technical detail. Finally, "enter hq code:= false" doesn't do anything. Heres the final script:

Code:
script, go to listen for code, begin

  if (check tag (tag: enter code)==ON) then, begin
    enter hq code:= true

    while (enter hq code) do, begin
      variable(key)
      for (key,2,57) do, begin
        # check all scancodes from "1" to SPACE
        if (keyval(key) >> 1) then, begin
          add this key(key)
        end
      end
      wait (1)
    end #end of the while command
    check for finished codes

    wait (1)
  end, else, begin
    wait (1)
  end

end # end of the plotscript


Do the textboxes use "${G16}", "${G16} ${G17}", etc, to show the keys the player has pressed? The problem with that is that the textboxes will show numbers instead of letters. If you want to show the player what they have typed in, you will need to use a string (see What is a string?) and last ascii. You'll need just a single textbox containing ${S#}. Lets assume you use textbox 437 for this and string 31, then here is a new addthiskey script. Your textbox should then contain "${S31}"

I also made it so that when you press the 4th letter, it exits the while loop in gotolistenforcode. Before this, there was no way to exit that loop and check whether the player entered a code!

Code:
script,add this key,key,begin
 
  if (key==Key:Backspace) then,begin
    # if backspace is pressed, reset the code
    reset code

  end,else,begin
    # any other key is recorded
    increment(nextletter)
    if (nextletter==1) then,begin
      L1:=key
    end,else,begin
      if (nextletter==2) then,begin
        L2:=key
      end,else,begin
        if (nextletter==3) then,begin
          L3:=key
        end,else,begin
          if (nextletter==4) then,begin
            L4:=key
            # finished typing in a code
            enter hq code:=false
          end
        end
      end
    end
  end

  append ascii (31, last ascii)
  show text box (437)

  show value (nextletter)

end


You'll also need to change resetcode to clear the string:

Code:
#script qui fait redemarrer le code
script, reset code, begin

  nextletter:=0
  L1:=0
  L2:=0
  L3:=0
  L4:=0
  clear string (31)
 
end# end of the plotscript


Note that the scancode (the argument key to addthiskey) is NOT the ascii value of the letter actually pressed! This is why I use lastascii.
For example, if you push the F key, the scancode will be key:f, but the ascii letter could be either f or F depending on whether you are pressing shift, and they have different values.

Finally, you wrote
Code:
define script (76,reset code, none)
define script (autonumber,go to listen for code, none)


But reset code only needs to be called from scripts, while go to listen for code needs to be called from your game. So I think you got these the wrong way around:

Code:
define script (76,go to listen for code, none)
define script (autonumber,reset code, none)


Ok. Any questions? :)
_________________
"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: Mon Aug 07, 2006 7:50 am    Post subject: I've got a few question Reply with quote

Waouh! Impressive! In the script check for finished code, you have put a
show text box (370). What about the other text boxes?

Thanks in advance!
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 Aug 09, 2006 12:33 am    Post subject: Reply with quote

You don't need them, the string embedded in the textbox can contain a one letter string or 4 letter string equally well.

Actually, prehaps the textbox could show before the player enters any keys at all. I don't know what you have in your textbox.
_________________
"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: Thu Aug 10, 2006 11:17 pm    Post subject: I've made some tests and... Reply with quote

The Mad Cacti wrote

Quote:
I don't know what you have in your textbox


I've have stars. (It's a key listen code afterall)

I've made some tests and I've got a blank text box with numbers on
bottom left corner of the playscreen which tends to proove that the script works.

What I try to do is the following

The script is launch a first text box pop-up automatically (it's a text box with an "_ " in it. It makes understand the player he can enter a code)

Then, the player enters the word spam. (or any other five letters word) As the player keys in is the last letter (and only on that moment) a script check the whole code. If the code is correct, a script is launch.

If the code is not correct another script is launched in which a text box appears (sorry this is not the right code) and make start from the beginning.

As always thanks very much for the help! Any suggestions of improvement are welcomed!
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: Mon Aug 14, 2006 2:48 am    Post subject: Reply with quote

Oh! I didn't realise you were using stars. Well, then you can continue to use your original addthiskey script. However, gotolistenforcode needs to be changed to let the player try over and over:

Code:
script, go to listen for code, begin

  if (check tag (tag: enter code)==ON) then, begin
    enter hq code:= true

    while (enter hq code) do, begin
      variable(key)
      for (key,2,57) do, begin
        # check all scancodes from "1" to SPACE
        if (keyval(key) >> 1) then, begin
          add this key(key)
        end
      end
      if (nextletter == 4) then (check for finished codes)
      wait (1)
    end #end of the while command

    wait (1)
  end, else, begin
    wait (1)
  end

end # end of the plotscript


And you need to make "check for finished codes" set "enter hq code" to false if the player got a code right!

Code:
script,check for finished codes,begin
  if(L1==key:S,and,L2==key:P,and,L3==key:A,and,L4==key:M) then,begin
     reset code
     # trigger the magical SPAM password!
     show text box (370)
    wait for text box
    enter hq code := false
  end
  if(L1==key:Q,and,L2==key:U,and,L3==key:I,and,L4==key:T) then,begin
     reset code
     # end the game
     game over
  end
end


Hopefully it'll all work now Happy
_________________
"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 Aug 16, 2006 10:21 pm    Post subject: I test the scripts and... Reply with quote

I launch the script and I still get a blank text box with number of the left side corner.
And strangly enough, after pressing keys four times the code does not reset.


Would somoene know why ?
Thanks in advance for the help!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bis_senchi




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

PostPosted: Fri Aug 25, 2006 8:53 am    Post subject: So? Reply with quote

So? would somoene has any suggestions?

Did you know that there was an article about the OHRRPGCE in the official wikipedia?

Feel free to click above and improve its quality!

http://en.wikipedia.org/wiki/OHRRPGCE
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 Aug 26, 2006 7:00 pm    Post subject: Reply with quote

Whoops, sorry, I didn't see your post.
I see I made a mistake, check for finished codes needs to reset the code:

Code:
script,check for finished codes,begin
  if(L1==key:S,and,L2==key:P,and,L3==key:A,and,L4==key:M) then,begin
     # trigger the magical SPAM password!
     show text box (370)
    wait for text box
    enter hq code := false
  end
  if(L1==key:Q,and,L2==key:U,and,L3==key:I,and,L4==key:T) then,begin
     # end the game
     game over
  end
  reset code
end


The textbox is blank? Are you using the original add this key script?
_________________
"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 Sep 20, 2006 7:28 am    Post subject: Hello! It's me again! Reply with quote

I would like to designate a part of the master palette for a sprite.
Could somoene explain me how to do this?

Thanks in advance for the help!
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 Previous  1, 2, 3  Next
Page 2 of 3

 
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