 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Torchic
Joined: 18 Oct 2010 Posts: 2
|
Posted: Mon Oct 18, 2010 5:47 pm Post subject: running scripts |
|
|
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 |
|
 |
Calehay ...yeah. Class B Minstrel

Joined: 07 Jul 2004 Posts: 549
|
Posted: Mon Oct 18, 2010 6:40 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|