Forums

Silly problems running scripts


Subscribe to Silly problems running scripts 8 posts, 4 voices

 

Jun 29, 2008 4:04pm

Shadow_Zed Shadow_Zed 4 posts

Hi, I have following problem:
Every time I want to test my game, I get following error messages:

COMPILATION ERROR in Script: script5
Error in code at line 24:
} else if(vspeed == 0){

at position 10: Unexpected symbol in expression.

or

COMPILATION ERROR in Script: script3
Error in code at line 15:
//Facing

at position 10: Unexpected symbol in expression.

I don't know, what has happened. Where are the errors?? I can't find them...
I use Windows Vista Home Premium. Can anyone help me, please??

PS: Sorry for my english.

 

Jun 29, 2008 4:18pm

Quinlan Vos Quinlan Vos 868 posts

It could be a couple things I'm not sure

#1 it looks like the brackets -- eg {} -- are facing the wrong way

#2 I've use the double = when dealing with vspeed

#3 thrre try getting rid of the regular brackets,

As I said I'm not sur if these things are causing the error.

I'd have to take a look at the script

try this :)

http://illusionest.forumotion.com/index.htm

 

Jun 29, 2008 7:49pm

Trollsplatterer Trollspla...
Moderator 2813 posts

I assume the compiler got the line wrong, as there can be no error in the line
//Facing

Could you show the entire code near the error? There's nothing wrong with those two lines, a double equal-sign is right and the brackets don't appear to be faced wrongly.

Do notice that this question belongs at the GMC!

Visit www.trollsplatterer.be for some files I made to help people out.

 

Jun 29, 2008 11:27pm

Nidoking Nidoking 656 posts

You'll need to show the entire script if you want anyone to help you.

 

Jun 30, 2008 3:45pm

Shadow_Zed Shadow_Zed 4 posts

Ok, here is one script, where the error appears:
The error appears nearly in every line in all my scripts

//(C) Shadows-Light-World.de
if(collision_point(self.x,self.y,obj_ladder,false,false) ==true){
//-----------------------------------------------------------------
//With ladder
self.sprite_index = spr_hero_climb;
//No-Key
if(keyboard_check(0)){
self.image_speed = 0;
self.image_index = 0; //SubBild 0
} else {
self.image_speed = 0.5;
}
//-----------------------------------------------------------------
}else{
//-----------------------------------------------------------------
//without ladder
//jump fall
if(vspeed != 0){
self.sprite_index = spr_hero_left_jump;
} else if(facing == 'right'){
self.sprite_index = spr_hero_right_jump;
}
self.image_index = 0;
self.image_speed = 0;

} else if(vspeed == 0){
//Facing
if(facing == 'left'){
self.sprite_index = spr_hero_left;
}else if(facing == 'right'){
self.sprite_index = spr_hero_right;
}
//No-Key
if(keyboard_check(vk_left) == true || keyboard_check(vk_right) == true){
self.image_speed = 0.5;
} else {
self.image_speed = 0;
self.image_index = 0;
}
}
//(C) Shadows-Light-World.de

I also get an error message when I start Gamemaker: Failed to set data for ''
maybe it has something to do with it

thank you all for your answers

 

Jul 3, 2008 2:06pm

Shadow_Zed Shadow_Zed 4 posts

" Failed to set data for '' "
Ok, I found this error in another topic.

I tried to run GameMaker as Administrator, this error is gone. But the compilation error is still appearing.
I also tried my script on anohter computer. No error at all...

Does anyone know, what to do??

 

Jul 3, 2008 8:57pm

Nidoking Nidoking 656 posts

Hint: Try using indenting and putting the curly braces on their own lines. When you do that, you should see something like this:

if (thingy)
{
stuff
}
else
{
stuff
}
else if // Hey, what do we have here?

You've got an "else" without an "if"! BINGO! Now, do that for all of your scripts and find the problems. Good coding standards go a long way!

 

Jul 4, 2008 7:19pm

Shadow_Zed Shadow_Zed 4 posts

Yes, it was a silly problem :-) ...

Thank you all for your answers, now it works fine.