Error when getting attributes from maps (get is not a function)

bambucha

  • *
  • Posts: 46
Hello,

since yesterday (with the newest version of Stencyl possible) i have been getting this error when changing a scene ONLY when publishing to Flash:
Code: [Select]
TypeError: Error #1006: get is not a function.
at scripts::SceneEvents_6/_customEvent_MakeGrayscale()[Source/scripts/SceneEvents_6.hx:85]
at scripts::SceneEvents_6/init()[Source/scripts/SceneEvents_6.hx:214]
at com.stencyl.behavior::Behavior/initScript()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/Behavior.hx:94]
at com.stencyl.behavior::BehaviorManager/initScripts()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/BehaviorManager.hx:97]
at com.stencyl::Engine$/initBehaviors()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:1111]
at com.stencyl::Engine/loadScene()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:982]
at com.stencyl::Engine/enterScene()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:1780]
at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2605]

There is no error on Android.  The only thing that I changed in my code since the previous version that worked perfectly was that i reworked some code to make use of maps (attributes).

Any ideas why i have this error?

Thank you!!

« Last Edit: January 25, 2015, 04:23:49 am by captaincomic »
Check out my games:
Highway Dodger    Highway Dodger 2     Dev Blog (in the making)
           

bambucha

  • *
  • Posts: 46
The error presists on diffrent Windows versions and computers.
I would really appreciate some help :)
Thanks!
Check out my games:
Highway Dodger    Highway Dodger 2     Dev Blog (in the making)
           

MrWagoner

  • Posts: 424
The error message gives you a hint where exactly the error occurs in your blocks / code. For your case it is the file

SceneEvents_6.hx in the line 85

Can you open your game in the stencyl workspace folder? There should be a subfolder "behaviors". Inside this folders you should see the file SceneEvents6.hx Open this file with a simple text editor and go to line 85. This should be the line of code that creates the error "get is not a function".
If possible, try to associate the code of the file with the blocks of that scene and post a screenshot of these blocks and the nasty line 85 here in the forum, we should be able to help you out then.

Check out my newest game: Blowy Fish!

bambucha

  • *
  • Posts: 46
Thanks, i was looking in code preview in stencyl, and the line numbers are messed up there.

I still dont know what could be wrong with my code 0.o
Here are the lines from 83 forward (85----  if(!(getGameAttribute("Ships").get("Ship2") == 1))  ----):
Code: [Select]
public function _customEvent_MakeGrayscale():Void
{
        if(!(getGameAttribute("Ships").get("Ship2") == 1))
{
            getActor(15).setFilter([createGrayscaleFilter()]);
}

        else
{
            recycleActor(getActor(6));
            getActor(15).clearFilters();
}

        if(!(getGameAttribute("Ships").get("Ship3") == 1))
{
            getActor(16).setFilter([createGrayscaleFilter()]);
}

        else
{
            recycleActor(getActor(5));
            getActor(16).clearFilters();
}
Screenshot of the blocks:


Any idea why it would produce this error?

« Last Edit: November 11, 2014, 07:03:07 am by bambucha »
Check out my games:
Highway Dodger    Highway Dodger 2     Dev Blog (in the making)
           

MrWagoner

  • Posts: 424
Hmm, I can't make out anything wrong with that line / with your code either. I tried to reproduce the issue in a small example game (see screenshot), and the exact same line of code does not produce an error for me (even if the value of Ship2 has not yet been set!).

However I found another thread that describes the problem and has a (strange) solution for this, maybe it is worth a try:

http://community.stencyl.com/index.php/topic,35744.msg202439.html

Check out my newest game: Blowy Fish!

bambucha

  • *
  • Posts: 46
Sorry for the late response,
I cleaned the project, cleaned up unused files, deleted, resterted Stencyl and readded the attribute (using the same name and keys).
But still, i get the same error as before. I have no idea what else would produce the error.
Check out my games:
Highway Dodger    Highway Dodger 2     Dev Blog (in the making)
           

captaincomic

  • *
  • Posts: 6109
Is the Ships game attribute a map?

If so, I think it is missing a cast here
Code: [Select]
getGameAttribute("Ships").get("Ship2")

captaincomic

  • *
  • Posts: 6109
I cannot reproduce the issue, it works for me without cast.  Would you mind sharing your project, so that I can take a look?

bambucha

  • *
  • Posts: 46
Hey!
Recently I have been getting this error, only in Flash (Android and Windows work fine):
Code: [Select]
TypeError: Error #1006: get is not a function.
at scripts::SceneEvents_15/_customEvent_UpdateIcons()[Source/scripts/SceneEvents_15.hx:89]
at MethodInfo-7878()[Source/scripts/SceneEvents_15.hx:415]
at com.stencyl.behavior::Script/loadGame()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/Script.hx:3571]
at scripts::SceneEvents_15/init()[Source/scripts/SceneEvents_15.hx:414]
at com.stencyl.behavior::Behavior/initScript()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/Behavior.hx:94]
at com.stencyl.behavior::BehaviorManager/initScripts()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/behavior/BehaviorManager.hx:97]
at com.stencyl::Engine$/initBehaviors()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:1111]
at com.stencyl::Engine/loadScene()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:982]
at com.stencyl::Engine/enterScene()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:1780]
at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2605]
SceneEvents_15.hx:89 points to this line:
Code: [Select]
getActor(60).setAnimation("" + ("" + getGameAttribute("Skills").get("MultiShot")));
Any idea on what could be causing the problem?

Thank you!!
Check out my games:
Highway Dodger    Highway Dodger 2     Dev Blog (in the making)
           

captaincomic

  • *
  • Posts: 6109
It is the same error that you had back then: http://community.stencyl.com/index.php/topic,36424.0.html
I'm merging the threads. But I'm sorry, I still have no idea what causes this or how to fix it...

CmdrWhitey13

  • Posts: 499
as animation block need to go along with it. Not sure in terms of code procedure though.

madscs

  • Posts: 39
I also ran into this error today. It produced the error for me only on flash but on Android it worked perfectly fine. Could it be something with the flash player setup/settings?