Topic: Error

Take a look at this

// ---------------------------------------------------------------------------

// Open Surge Engine

// http://opensnc.sourceforge.net

//

// File:   objects/default_startup/opening_animation.inc

// Desc:   opening animation

// Author: Alexandre

// Date:   2011-01-01

// ---------------------------------------------------------------------------



object ".default_startup.opening_animation"

{
    
     requires 0.2.0
    
     always_active

    
     state "main"
    
{
        
        hide

        
        set_absolute_position 0 0

        let "$_ds_op_zindex = 9999"
        create_child ".fade_effect"
        let $fade_in=1
}
}

I try to run the game with this script and it says "unexpected symbol on line 23: "{"

I don't see anything wrong with it. For the most part the symbol on line 23 is "}" not "{".

Re: Error

For a { there has to be a }

This error could be that you have too few or too many of either.

Re: Error

two { are missing, one after the object is declared, another one after the main state is declared

EDIT: actually forget that, somehow i couldn't see them in a mobile browser

Last edited by KZR (2013-02-09 15:47:44)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Error

// ---------------------------------------------------------------------------
// Open Surge Engine
// http://opensnc.sourceforge.net
//
// File:   objects/default_startup/opening_animation.inc
// Desc:   opening animation
// Author: Alexandre
// Date:   2011-01-01
// ---------------------------------------------------------------------------
object ".default_startup.opening_animation" {
     requires 0.2.0
     always_active
    
     state "main" {
        hide
        set_absolute_position 0 0
        let "$_ds_op_zindex = 9999"
        let "$_fade_in = 1"

        create_child ".fade_effect"
    }
}

Actually according to what I'm seeing he has the right number of opening brackets and closing brackets, I'm betting that the problem is really in the ".fade_effect" or the startup file that is calling this file because if there is a missing bracket in one of those files it could potentially trip the nanoparser to error here.  Also, as a note, I've gone ahead and changed the spacing a bit just so I could better understand the code bracket issues that may have been present in this file. Also, do note that your $fade_in is going to a local variable when I'm pretty sure it's meant to be going to a global that you should be declaring before you call the subobject, so as such I have changed the order of it a bit, changed $fade_in to $_fade_in, and made the variable declaration style a little more consistent.  If you want further help bughunting please take a look at the 2 files I referred to and make sure that every one of them and every file they in turn call has the proper amount of opening and closing brackets, and then if your code still doesn't work post the contents of those files here so I can better understand your bug.
Thanks.

EDIT: The problem may actually be in all those blank lines between your commented lines at the top, I got rid of those spaces so try the above code before you go on your big bughunt.

Last edited by lunarrush (2013-02-09 11:26:11)

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: Error

lunarrush wrote:

EDIT: The problem may actually be in all those blank lines between your commented lines at the top, I got rid of those spaces so try the above code before you go on your big bughunt.

That actually happened when I pasted the code from the file to the web page.

EDIT: Ok it works perfectly fine now. Thanks for the help
EDIT 2:Now when I start a level the screen stays completely black.

Last edited by S32X (2013-02-09 17:00:24)

Re: Error

Sry for the double post, but I don't think anyone saw my last post edit.


S32X wrote:

EDIT 2:Now when I start a level the screen stays completely black.

Re: Error

S32X wrote:

Sry for the double post, but I don't think anyone saw my last post edit.


S32X wrote:

EDIT 2:Now when I start a level the screen stays completely black.

Yes. Let's go together into this. We will find this out, together.

Please take a look at this piece of code:

...
     state "main" {
        hide
        set_absolute_position 0 0
        let "$_ds_op_zindex = 9999"
        let "$_fade_in = 1"

        create_child ".fade_effect"
    }
...

Tell us, what exactly does it do? smile

Re: Error

Alexandre wrote:
...
     state "main" {
        hide
        set_absolute_position 0 0
        let "$_ds_op_zindex = 9999"
        let "$_fade_in = 1"

        create_child ".fade_effect"
    }
...

Tell us, what exactly does it do? smile

This script have level start as a black screen and then fade-in to the level.

Re: Error

S32X wrote:

This script have level start as a black screen and then fade-in to the level.

yes, indeed, it sets some globals and then a .fade_effect object is created. smile

and then what? why does the screen stays black?

tip: check the memory usage of the program

Re: Error

I have no clue why the screen stays black. But after like 10 seconds of being in this state I noticed that the music starts to skip.

Alexandre wrote:

tip: check the memory usage of the program

I don't know how to do that.

Re: Error

S32X wrote:

I have no clue why the screen stays black. But after like 10 seconds of being in this state I noticed that the music starts to skip.

so, why does the music start to skip?

Re: Error

Again, I don't know. It may have to do with the fact that game just being stuck with the black screen it just forgets what to do...

Re: Error

S32X wrote:

Again, I don't know. It may have to do with the fact that game just being stuck with the black screen it just forgets what to do...

So, let's investigate this together. There are at least three issues:

  • the screen stays black

  • the music starts to skip after 10 seconds

  • the game "gets stuck"

Could these problems be related? If so, why?

Well, a simple test reveals that these problems only occur when the object .default_startup.opening_animation is created. And when they occur, they occur at the same time - which suggests that the listed issues are related.

So, this is rather mysterious. What is the cause?

...
     state "main" {
        hide
        set_absolute_position 0 0
        let "$_ds_op_zindex = 9999"
        let "$_fade_in = 1"

        create_child ".fade_effect"
    }
...

hmmmmmm...

Re: Error

Little tip s32x, that code's going to keep looping again and again until you change states, it's not like a method call in standard programming where you can call a void method and it will run only once, you must change states after it runs or you get a memory leak.

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: Error

lunarrush wrote:

Little tip s32x, that code's going to keep looping again and again until you change states, it's not like a method call in standard programming where you can call a void method and it will run only once, you must change states after it runs or you get a memory leak.

*facepalm* I can be so blind sometimes. I can't believe I didn't see that. Ah well, it's been awhile since I've messed with the Engine. Thanks for your (obvious) help.