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

running scripts

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Torchic




Joined: 18 Oct 2010
Posts: 2

PostPosted: Mon Oct 18, 2010 5:47 pm    Post subject: running scripts Reply with quote

ok im kinda new to this kinda thing soi suck with scripting...

anyway theres a error in one of my scripts saying that i missed a end or (..

script,run,begin
if,begin
key is pressed (key:x)
end
then,begin
if (hero is walking (me)==false)
then,begin
set hero speed (me,5)
else,begin
if (hero is walking (me)==false)
then,begin
set hero speed (me,4)
end

can anyone correct this? -
Back to top
View user's profile Send private message
Calehay
...yeah.
Class B Minstrel



Joined: 07 Jul 2004
Posts: 549

PostPosted: Mon Oct 18, 2010 6:40 pm    Post subject: Reply with quote

You're missing a few end statements. The script should be:
Code:
script,run,begin
if,begin
key is pressed (key:x)
end
then,begin
     if (hero is walking (me)==false)
     then,begin
          set hero speed (me,5)
     end
     else,begin
          if (hero is walking (me)==false)
          then,begin
               set hero speed (me,4)
          end
     end
end
end
 


I suggest using parenthesis instead of "begin" and "end" (outside of the start of the script and the end of the script.) and using tab spaces when doing a lot of if statements inside of if statements. It's a lot easier to read:

Code:
script,run,begin
if (key is pressed (key:x)) then
     (
     if (hero is walking (me)==false) then
          (
          set hero speed (me,5)
          )
     else
          (
          if (hero is walking (me)==false) then
               (
               set hero speed (me,4)
               )
          )
     )
end


This way, it's much easier to see where you'll need a closing parenthesis or end statement.
_________________
Calehay
Back to top
View user's profile Send private message 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