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

make an npc says something different with the d key
Goto page Previous  1, 2, 3, 4, 5  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: Sun Apr 01, 2007 9:24 pm    Post subject: Put a "suspend box advance" before the "show Reply with quote

Uncommon said
Quote:
Put a "suspend box advance" before the "show textbox " in the talkwithD script. Hell, just put it at the top of the script


That's what I did. I put a suspend box advance command at the top of the script (I've posted only an extract) and I've made an extra test adding the "suspend box" command before the "show text box" command.

And guest what? It didn't worked Oookay...
So I think that my script "keypresswhilepeaking" won't be that useless after all...
Thanks for answering so quickly!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Sun Apr 01, 2007 11:22 pm    Post subject: Re: Put a "suspend box advance" before the "s Reply with quote

bis_senchi wrote:
So I think that my script "keypresswhilepeaking" won't be that useless after all...

Or it might even be causing the problems. I dunno. Have you tried a run-through without it?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Mon Apr 02, 2007 6:03 am    Post subject: Reply with quote

Where did you put the suspend box command?

Try:

Code:
script, talkwithD, begin #extract of talkwithD

  case(9) do, begin
  set npc direction (9, (MyDirection+2,mod,4))
  suspend box advance
  show text box (78)
  wait for key (key:d)
  advance text box
  wait(1)
  resume box advance
  end


Quote:
So I think that my script "keypresswhilepeaking" won't be that useless after all...


Right now it is. Look very carefully at where you're calling it. The script paused while it waits for the d key to continue (and since you don't pause the text box advance before displaying it, I'm assuming it will still go away with a spacebar press...). Therefore, when you try to prevent any keyboard input besides the D key, the text box is already gone! Also, it looks like you set the on keypress script to mykeypresswhilespeaking in the mykeypresswhilespeaking, which means that after you successfully talk with d once, you won't be able to do it again, since each keypress simply calls the mykeypresswhilespeaking from then on. (Unless script 21 is another script, in which case it looks like mykeypresswhilespeaking won't work at all).
Back to top
View user's profile Send private message
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Mon Apr 02, 2007 5:08 pm    Post subject: Reply with quote

Are we sure that "wait for key" can accept any value, and then wait for that specific key? In the plotdictionary it only says that it can accept the playable keys, or "any key".

I knew this was going to be a pain. I'm not sure what is wrong. The best I can offer right now is getting rid of the line
Code:
set on keypress script (21 )

inside of the case blocks in your TalkWithD script. I think there is a deeper underlying problem somewhere though; I'll have to get back to you on it.

EDIT: Actually, can you go ahead and post the full script for TalkWithD? That might help us. Furthermore, I just wanted to reiterate that this will only work as long as the text being called with D is only one box long (no "use box # next" usage in custom for text boxes called by D)
_________________
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
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon Apr 02, 2007 9:18 pm    Post subject: Reply with quote

msw188 wrote:
Are we sure that "wait for key" can accept any value, and then wait for that specific key? In the plotdictionary it only says that it can accept the playable keys, or "any key".


that is correct. "wait for key" can only accept a very small selection of arguments. The command you want instead is wait for scancode
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bis_senchi




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

PostPosted: Tue Apr 03, 2007 8:09 pm    Post subject: Very close to the solution Reply with quote

I've made some more tests and I managed to prevent the space bar from being efficient and from making disapearing the text box. The only little thing that left if I first press the space bar and then d the text box don't disappear.

After I pressed the space bar, I have to press D twice (whereas it should be one) to make disappear the text box.

I think it is due to the fact that the script has ended. (The second time I pressD the script launch and everything is fine: the text box disappear).

May be I should make reset the script but if I add a line with "talkwithD" in it I'm afraid the script overloads. So what should I put instead of wait (1)?


Code:


script, talkwithD, begin

suspend player
suspend npcs

variable (MyDirection, Xcheck, Ycheck)
MyDirection:= hero direction (me)
Xcheck:= heroX (me)
Ycheck:= heroY (me)

switch (hero direction (me)) do, begin
  case (north) do ( Ycheck -= 1)
  case (south) do ( Ycheck += 1)
  case (left) do ( Xcheck -= 1)
  case (right) do ( Xcheck += 1)
 end
 
  switch (get NPC ID (NPC at spot (Xcheck, Ycheck)) ) do, begin
 
  case(2) do , begin
  set npc direction (2,(MyDirection+2,mod,4))
  suspend box advance
  show text box (61)
  wait for key (key:d)
  if (key is pressed (key:d)==true) then, begin
  advance text box
  wait(1)
  resume box advance
  end, else, begin #if it is not D/ the space bar then, begin...
  wait (1)
  end
  end #end for case

  case(9) do , begin
  set npc direction (9,(MyDirection+2,mod,4))
  suspend box advance
  show text box (72)
  wait for key (key:d)
  if (key is pressed (key:d)==true) then, begin
  advance text box
  wait(1)
  resume box advance
  end, else, begin #if it is not D/ the space bar then, begin...
  wait (1)
  end
  end #end for case

end #end of plotscript



As always thanks so much to all of you for keeping on helping and advicing me!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Tue Apr 03, 2007 8:40 pm    Post subject: Reply with quote

Replace the commands
Code:
wait for key (key:d)

with
Code:
wait for scancode (key:d)


(See James Paige's post)

Also, using this setup, you can safely get rid of the if checks regarding key is pressed. Basically, your code inside a switch case should look like:
Code:
  case(2) do , begin
  set npc direction (2,(MyDirection+2,mod,4))
  suspend box advance
  show text box (61)
  wait for scancode (key:d)
  advance text box
  wait(1)
  resume box advance
  end #end for case


Also, what happened to the global variable for disactivating MyKeyPressed? This is most likely VERY important to have if we want this whole waiting for D thing to work properly. See my post way back where I talk about getting rid of UndoD and moving your
Code:
disactive:=true

code.
_________________
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
bis_senchi




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

PostPosted: Thu Apr 05, 2007 2:28 am    Post subject: hss can't compile Reply with quote

I've tried to compile my game and it appeared that the command was unknown. I've replaced my plotscr.hsd by the most recent plotscr.hsd but the command is still unknow.

Does anybody knows why??
Good luck in making you games all!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Thu Apr 05, 2007 5:33 am    Post subject: Reply with quote

Strange, I don't know what to say about that. The best I can offer is a reminder that according to the link Paige gave us, you need to include not only plotscr, but also scancode.hsi. Other than that, you'll have to wait for one of the developers here, I'm afraid. Wait for scancode is not documented in the stable plotdictionary.
_________________
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
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Apr 05, 2007 6:39 am    Post subject: Re: hss can't compile Reply with quote

bis_senchi wrote:
I've tried to compile my game and it appeared that the command was unknown. I've replaced my plotscr.hsd by the most recent plotscr.hsd but the command is still unknow.

Does anybody knows why??
Good luck in making you games all!


plotscr.hsd is actually a plain text file. You can open it up and look at it.

If you are really using the latest version of scancode.hsd you should be able to see a line that looks something like this:

Code:

244,waitforscancode,1,0       #waits for a specific scancode


If it is not there, then your plotscr.hsd is not really the newest.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bis_senchi




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

PostPosted: Thu Apr 05, 2007 8:47 pm    Post subject: When should I turn true and when should I turn false... Reply with quote

Ok! I've add the line myself and the game compiles. But when I test it and press on D I still can use (whereas I should not) the space bar to make disappear the text.

This is due to the fact that I've deleted the line Oookay... ( see my post of the Wed Apr 04, 2007 for more details.)

Msw188 said
Quote:

this is most likely VERY important to have if we want this whole waiting for D thing to work properly


And then Msw188 has posted
Code:

disactive:=true
Oookay...

Could somoene remind me of where to put in my code the line that turn true and the one that turn false the disactive global variable so that my script will work properly.

Thanks in advance for the help!
_________________
It's time to make games!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Fri Apr 06, 2007 8:37 am    Post subject: Reply with quote

The purpose of the disactive variable is to stop MyKeyPressed from working. We don't want MyKeyPressed working while TalkWithD is working, so we put the line
Code:
disactive:=true

at the VERY top of TalkWithD and the line
Code:
disactive:=false

at the VERY bottom of TalkWithD. Then your MyKeyPressed script should look like:
Code:
script, MyKeyPressed, begin
if(disactive==false),then
begin

#all of your MyKeyPressed script, including all suspend
#and resume commands.  NOTHING should be outside
#of this if block of code.

end #end of disactive if

end #end of script


Then as long as all of your case blocks of code in TalkWithD are exactly like the example I posted four or five posts ago, I'm pretty sure this should work. If it does not work this time, make sure to post both full scripts MyKeyPressed and TalkWithD next time, as we'll probably need them to fix any further problems.
_________________
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


Last edited by msw188 on Fri Apr 06, 2007 2:20 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Fri Apr 06, 2007 12:05 pm    Post subject: Reply with quote

Just make sure that then in the block msw posted above has a "(" or a ",begin" right after it, or you'll go through hell trying to compile it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Fri Apr 06, 2007 2:19 pm    Post subject: Reply with quote

Oops. Right after posting this, I will go back and edit Uncommon's begin into my post, but I also wanted to post this so no one gets confused about a begin being there, but what is Uncommon talking about...?
_________________
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
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Fri Apr 06, 2007 2:32 pm    Post subject: Reply with quote

Oh, oh, nevermind. It is in msw's post, it's just it being on a different line from the then confused me. Ignore my earlier post.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
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, 4, 5  Next
Page 4 of 5

 
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