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

Stupid Text Box

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Tue Feb 03, 2004 1:23 pm    Post subject: Stupid Text Box Reply with quote

Ok, so I've coded something that displays a text box everytime you press some key (say, x and text box 1 pops up) but the dumb thing suspends hero movement when you press it. Is there a way to, in a script, disable the "suspend player" aspect of text boxes, and then make taht aspect return after the script has ended? (Ie "resume player in text boxes" "suspend player in text boxes", etc.)

All help will be appreciated.
_________________
But enough talk, have at you!
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Feb 03, 2004 10:54 pm    Post subject: Reply with quote

You have to write your own code that moves the hero according to what keys you press. It's very easy to do, but hard to perfect.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Setu_Firestorm
Music Composer




Joined: 26 Mar 2003
Posts: 2566
Location: Holiday. FL

PostPosted: Wed Feb 04, 2004 3:20 pm    Post subject: Reply with quote

That sort of thing is in Cube's department, too. Well, if you're trying to do what I think you're trying to do.
_________________


Facebook: http://www.facebook.com/georgerpowell
Newgrounds: http://setu-firestorm.newgrounds.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Wed Feb 04, 2004 3:24 pm    Post subject: Reply with quote

I'm trying to become supreme dictator of the world, but if Cube can help with my text box problem, I will be very appreciative.
_________________
But enough talk, have at you!
Back to top
View user's profile Send private message Send e-mail
Shaede
Tuck in your shirt.




Joined: 08 Jan 2004
Posts: 107

PostPosted: Wed Feb 04, 2004 5:01 pm    Post subject: Reply with quote

The Mad Cacti wrote:
You have to write your own code that moves the hero according to what keys you press. It's very easy to do, but hard to perfect.


He's got the right idea. You can't move the hero once the text box appears, but plotscripting can. Heres an example:

Code:

variable (done,0)
show text box(0)

while (done == 0) do (
wait for key

if (key is pressed == 72) then (
wait for hero (me)
walk hero (me,up,1)
)
if (key is pressed == 80) then (
wait for hero (me)
walk hero (me,down,1)
)
if (key is pressed == 75) then (
wait for hero (me)
walk hero (me,left,1)
)
if (key is pressed == 77) then (
wait for hero (me)
walk hero (me,right,1)
)
if (key is pressed == 57, or, key is pressed == 28) then (
increment(done)
advance text box
)
)


Unfortuanatly, you'll experience slowdown because the "wait for key" and "key is pressed" functions stack. If there was a function that returned the value of the key you pressed, you could use that instead. I don't think the OHR has a command like that, so I think this is about the best method you got as far as moving while in a text box.
Back to top
View user's profile Send private message Visit poster's website
Mr B




Joined: 20 Mar 2003
Posts: 382

PostPosted: Wed Feb 04, 2004 7:32 pm    Post subject: Reply with quote

Hmm...I thought that you just wanted to make the variable display in the lower left-hand corner.

Since you don't, I really can't help you. Certainly not more than the above-posted guys can. Listen to them -- it does a plotscripter good.
Back to top
View user's profile Send private message
Cube
Dimensional Traveller




Joined: 02 Feb 2003
Posts: 294

PostPosted: Wed Feb 04, 2004 9:11 pm    Post subject: Reply with quote

[quote="Shaede"]
Code:

variable (done,0)
show text box(0)

while (done == 0) do (
wait for key

if (key is pressed == 72) then (
wait for hero (me)
walk hero (me,up,1)
)
if (key is pressed == 80) then (
wait for hero (me)
walk hero (me,down,1)
)
if (key is pressed == 75) then (
wait for hero (me)
walk hero (me,left,1)
)
if (key is pressed == 77) then (
wait for hero (me)
walk hero (me,right,1)
)
if (key is pressed == 57, or, key is pressed == 28) then (
increment(done)
advance text box
)
)
[quote]

That's almost right, but I need to change/point out a couple things Wink.

Firstly, key is pressed() is used with an argument. So, you'd put those numbers in the brackets rather than comparing them with an equal to sign. Also, it would be a lot easier to include scancode.hsi and just type:

key is pressed(key:up)

rather than using the actual number (key:right, key:left:, key:down are also there Raspberry!). So:

if (key is pressed(key:up)) then (
whatever
)

Will work just fine.

Also, there's no need to have the "wait for key" command. Instead, replace it with "wait(1)". This way, you should get less lag and the keys will be more responsive. Sure, it may be looping really fast but that won't really effect anything. I've used more complex stuff than this in loops using the same method Wink.

(Also, just so you know. key:space and key:enter will work in that last statement where "done" is incremented. Don't forget to place those in brakets too!)
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed Feb 04, 2004 10:47 pm    Post subject: Reply with quote

Now I need to point something out too. Using 'wait for hero' before each walk command adds a 1-tile-walk lag. But if you replace it with wait (1), the walk hero commands add to the walk-stack faster than the hero moves, as it takes 5 ticks to walk one tile. Also, you tried to initialise the variable 'variable (done, 0)'

Code:

variable (done, ww) #ww= will walk
show text box(0)

while (done == 0) do (
wait (1)
wait for hero(me)
ww := 0

if (key is pressed(key:up)) then (
walk hero (me,up,1)
ww := 1
)
if (key is pressed(key:down), and, ww == 0) then (
walk hero (me,down,1)
ww := 1
)
if (key is pressed(key:left), and, ww == 0) then (
walk hero (me,left,1)
ww := 1
)
if (key is pressed(key:right), and, ww == 0) then (
walk hero (me,right,1)
)
if (key is pressed(key:space), or, key is pressed(key:enter)) then (
increment(done)
)
)



Also, the advance textbox was not needed as the hero is not suspended (unless you want them to be). I added in ww to prevent the hero from walking diagonally.

Anyway, like I said I write this thing several times, but its hard to get it looking exactly like it does normally, so you'll have to play around a bit. I always loss+forget what I did last time.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
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