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

Scripting problem

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Sep 10, 2004 12:14 pm    Post subject: Scripting problem Reply with quote

I can't get this script to work.
It cancels out the "if, then, else" commands.
What do I have to do to fix it?

Could someone also tell me what the "Please post long scripts with the pre tag." is about? I don't get it.

script, my script, begin
suspend player
suspend cata pillar
set hero picture (find hero (2), 49, outside battle)
set hero palette (find hero (2), 60, outside battle)
teleport to map (12, 6, 4)
delete item (31, 1)
walk hero to x (1, 0)
walk hero to y (1, 4)
walk hero to x (2, 0)
walk hero to y (2, 5)
walk hero to x (3, 0)
walk hero to y (3, 6)
show text box (465)
wait for text box
create npc (random (0, 5),6, 6, right)
create npc (random (0, 5),9, 7, left)
create npc (random (0, 5),6, 8, right)
create npc (random (0, 5),15, 9, left)
if (key is pressed (33))
then (
wait (5)
write map block (5, 4, 70)
set hero speed (10)
walk hero (find hero (2), right, 4)
wait for hero (find hero (2))
set hero speed (find hero (2), 2)
walk hero (find hero (2), down, 5)
wait (5)
set tag (34 , on)
suspend obstruction
set hero speed (10)
walk hero to x (me, 5)
walk hero to y (me, 4)
)
else (
)
set tag (34, off)
resume obstruction
set hero picture (find hero (2), 0, outside battle)
set hero palette (find hero (2), 58, outside battle)
teleport to map (6, 49, 29)
resume cata pillar
resume player
end
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Sep 10, 2004 1:18 pm    Post subject: Reply with quote

It means you should say <pre> before every big block of code and </pre> afterward. I think the "code" tag works just as well.

It may be that you mean to have the "if" block in a loop. As is, the script will only trigger that "then" block if that key ("F") was already being held down. Also, there is nothing in the "else" statement.

I really don't know what you're trying to do with this script. If you don't find that analysis useful, you'll have to post more info.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Machu
Righter, a person who rights wrongs




Joined: 09 Jul 2003
Posts: 737

PostPosted: Fri Sep 10, 2004 1:21 pm    Post subject: Reply with quote

You mean this tag?

Code:
script, my script, begin
suspend player
suspend cata pillar
set hero picture (find hero (2), 49, outside battle)
set hero palette (find hero (2), 60, outside battle)
teleport to map (12, 6, 4)
delete item (31, 1)
walk hero to x (1, 0)
walk hero to y (1, 4)
walk hero to x (2, 0)
walk hero to y (2, 5)
walk hero to x (3, 0)
walk hero to y (3, 6)
show text box (465)
wait for text box
create npc (random (0, 5),6, 6, right)
create npc (random (0, 5),9, 7, left)
create npc (random (0, 5),6, 8, right)
create npc (random (0, 5),15, 9, left)
if (key is pressed (33))
then (
wait (5)
write map block (5, 4, 70)
set hero speed (10)
walk hero (find hero (2), right, 4)
wait for hero (find hero (2))
set hero speed (find hero (2), 2)
walk hero (find hero (2), down, 5)
wait (5)
set tag (34 , on)
suspend obstruction
set hero speed (10)
walk hero to x (me, 5)
walk hero to y (me, 4)
)
else (
)
set tag (34, off)
resume obstruction
set hero picture (find hero (2), 0, outside battle)
set hero palette (find hero (2), 58, outside battle)
teleport to map (6, 49, 29)
resume cata pillar
resume player
end


That would be the Code button. Are you saying that neither the then nor else stuff runs? For one thing, the else statement ends right away. That right parenthesis should be at the end of what only happens during "else". For the "then" stuff to run, the appropriate button would have to be held down the instant the text box is advanced. From the looks of things, there need to be a few more wait commands in there, but I don't know what effect you are trying to create, so I can't really fix this.
_________________
Code:
[*]That's it
[*]I'm done reasoning with you
[*]Starting now, there's going to be a lot less conversation and a lot more killing
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Sep 10, 2004 1:24 pm    Post subject: Reply with quote

DOUBLE POST OF SAME MEANING AT THE SAME TIME!

:o

We are SO brain-twins.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sat Sep 11, 2004 2:39 am    Post subject: Reply with quote

This script is basically supposed to be a BOF type fishing game.

Code:

script, my script, begin
suspend player
suspend cata pillar
set hero picture (find hero (2), 49, outside battle)
set hero palette (find hero (2), 60, outside battle)

#The above turns the hero picture into a piece of bait
 
teleport to map (12, 6, 4)
delete item (31, 1)

#Deletes the item that allows you to go fishing, that way you have to buy more

walk hero to x (1, 0)
walk hero to y (1, 4)
walk hero to x (2, 0)
walk hero to y (2, 5)
walk hero to x (3, 0)
walk hero to y (3, 6)

#Gets everyone else away from the main hero

show text box (465)
wait for text box

#A text box giving directions.

create npc (random (0, 5),6, 6, right)
create npc (random (0, 5),9, 7, left)
create npc (random (0, 5),6, 8, right)
create npc (random (0, 5),15, 9, left)

#Creates a random set of four fish
 
#Everything below here doesn't work.

if (key is pressed (33))
then (
wait (5)
write map block (5, 4, 70)
set hero speed (10)
walk hero (find hero (2), right, 4)
wait for hero (find hero (2))
set hero speed (find hero (2), 2)
walk hero (find hero (2), down, 5)
wait (5)
set tag (34 , on)
suspend obstruction
set hero speed (10)
walk hero to x (me, 5)
walk hero to y (me, 4)
)
else (

# I know there isn't anything in the else, but there isn't supposed to be. You're not supposed to do anything but push the "f" key.

)

set tag (34, off)
resume obstruction
set hero picture (find hero (2), 0, outside battle)
set hero palette (find hero (2), 58, outside battle)
teleport to map (6, 49, 29)
resume cata pillar
resume player
end


Do you need anymore explaining?

[Edit by Aeth: Fyre already did it for me but I'm reposting it with the code tags anyway. Use pre on Hamsterrepublic's help me forums, use code here in the future.]
Back to top
View user's profile Send private message Send e-mail AIM Address
RPGCreations
E Pluribus Unum




Joined: 18 May 2003
Posts: 345

PostPosted: Sat Sep 11, 2004 2:51 am    Post subject: Reply with quote

Code:

script, my script, begin
suspend player
suspend cata pillar
set hero picture (find hero (2), 49, outside battle)
set hero palette (find hero (2), 60, outside battle)

#The above turns the hero picture into a piece of bait
 
teleport to map (12, 6, 4)
delete item (31, 1)

#Deletes the item that allows you to go fishing, that way you have to buy more

walk hero to x (1, 0)
walk hero to y (1, 4)
walk hero to x (2, 0)
walk hero to y (2, 5)
walk hero to x (3, 0)
walk hero to y (3, 6)

#Gets everyone else away from the main hero

show text box (465)
wait for text box

#A text box giving directions.

create npc (random (0, 5),6, 6, right)
create npc (random (0, 5),9, 7, left)
create npc (random (0, 5),6, 8, right)
create npc (random (0, 5),15, 9, left)

#Creates a random set of four fish
 
#Everything below here doesn't work.

if (key is pressed (33)) then (
  wait (5)
  write map block (5, 4, 70)
  set hero speed (10)
  walk hero (find hero (2), right, 4)
  wait for hero (find hero (2))
  set hero speed (find hero (2), 2)
  walk hero (find hero (2), down, 5)
  wait (5)
  set tag (34 , on)
  suspend obstruction
  set hero speed (10)
  walk hero to x (me, 5)
  walk hero to y (me, 4)
)

set tag (34, off)
resume obstruction
set hero picture (find hero (2), 0, outside battle)
set hero palette (find hero (2), 58, outside battle)
teleport to map (6, 49, 29)
resume cata pillar
resume player
end


What happened is you had the if and then on a seperate line - they always need to be written as

if(condition) then ( actions )

otherwise, HSPEAK doesn't know what IF the THEN belongs to. I have fixed this above.

Also, you don't need to have an empty "else" if there is nothing to put there. I have gotten rid of it.
_________________
Back to top
View user's profile Send private message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sat Sep 11, 2004 3:08 am    Post subject: Reply with quote

Now the script works a little better, but it doesn't give the player time to hit the "f" key. It shows the text box, then teleports the player to the map that they came from.
Back to top
View user's profile Send private message Send e-mail AIM Address
RPGCreations
E Pluribus Unum




Joined: 18 May 2003
Posts: 345

PostPosted: Sat Sep 11, 2004 3:26 am    Post subject: Reply with quote

Oh. You'll need to put a wait for key before the if, or, put it inside a while loop that loops around until F is hit or F is not being hit.
_________________
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Sep 11, 2004 6:30 am    Post subject: Reply with quote

The if and then can be on separate lines. I think the WH script even does it. The problem is almost definitely with the keyispressed.

TH, please use the "code" tag to post your stuff. If Fyre hadn't reposted it, I would've ignored your post.

Try this instead of your if/then block:
Code:

while (key is pressed (33)==false) do (wait(1)) #waits for player to press F
 #now do what was going to be done
 wait (5)
 write map block (5, 4, 70)
 set hero speed (10)
 walk hero (find hero (2), right, 4)
 wait for hero (find hero (2))
 set hero speed (find hero (2), 2)
 walk hero (find hero (2), down, 5)
 wait (5)
 set tag (34 , on)
 suspend obstruction
 set hero speed (10)
 walk hero to x (me, 5)
 walk hero to y (me, 4)
)

_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sun Sep 12, 2004 3:30 am    Post subject: Reply with quote

How does this so called "code tag" work?
Back to top
View user's profile Send private message Send e-mail AIM Address
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Sun Sep 12, 2004 11:18 am    Post subject: how to use the [code] tag Reply with quote

the code prevents the message board from eating your script's indentation, and puts it in a nice pretty box.

To do this, just put [code] before your script and [/code] after your script

[code]
  if(something)
  then, begin
    some
    stuff
    happens
    here
  end
[/code]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Machu
Righter, a person who rights wrongs




Joined: 09 Jul 2003
Posts: 737

PostPosted: Sun Sep 12, 2004 11:20 am    Post subject: Reply with quote



Code:

this is my script

_________________
Code:
[*]That's it
[*]I'm done reasoning with you
[*]Starting now, there's going to be a lot less conversation and a lot more killing
Back to top
View user's profile Send private message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Thu Sep 16, 2004 9:55 am    Post subject: Reply with quote

Okay, so that works. And I'm guessing that everything else is the same?
(Quote, Img, etc?)

wait, let me test it...

Code:

Ha! It's in a box!


And while I'm reviving this thread instead of createing a new one, How do you get images to show up?

I tried:


But that just shows the site name along with the [img], [/img] things.[/list]

edit: Okay, thanks.


Last edited by TwinHamster on Fri Sep 17, 2004 11:21 am; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail AIM Address
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Thu Sep 16, 2004 1:19 pm    Post subject: Reply with quote



Be careful of spaces when listing a URL.
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
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