Need Help With FGL's GameTracker API [SOLVED]

Alan1

  • Posts: 88
I'm trying to install but having no luck. When trying to test the game it stops part way through, "Generating SWF". When trying to publish, the following message appears:

Quote
Unable to export SWF to the requested location.(Check your logs. Usually, the cause is an incompatible sound file.)
(I currently have no sound files in the game file I'm using)

Here's what I've done so far:

I copy-pasted the .as files into separate Freeform behaviours. Wasn't sure what to use for the, "Classname" or if it was even important. Tried using their respective file names as well as, "GameTracker" for both. Didn't appear to make a difference.

From FGL's instructions:

Quote
Once you have a list of the data that you would like to collect, the next step is to initialize the API to make it ready to use. Start by creating an instance of the GameTracker class somewhere in your code.

My guess is that this is the same as

Quote
You must call new GameTracker(); before it can be used!

So, I placed, "new GameTracker();" into a code block and Create wrapper(see attachment)

If I remove this code block, it tests and publishes fine. I also tried copying the FGL folder into my game folder as per

Quote
Copy the FGL directory into your game folder so that your code can access the FGL.GameTracker package.

But without the Freeform behaviours, I get this error message:

Quote
Behavior contains fields that are either empty or filled with bad data...Call to a possibly undefined method GameTracker.

I'm still using v2.20, so my guess is either I missed something or FGL's GameTracker will not work with 2.2.0.

Here are the links to FGL's instructions

https://www.fgl.com/view_library.php?page=gametracker
https://www.fgl.com/GameTrackerAPI.php

Anyone have any thoughts?

« Last Edit: July 22, 2015, 11:08:16 am by Alan1 »
"Oh man, this isn't happening, it only thinks it's happening." ~Flynn

Justin

  • *
  • Posts: 4716
When you import the two files, make sure you specify package as "FGL.GameTracker", and the classnames should be "GameTracker" and "GameTrackerErrorEvent".

In addition to the "new GameTracker();" code, you should have an import event with "import FGL.GameTracker;" according to the docs... though maybe my AS3 memories are really bad because I haven't used it in a long time, but I would think you want "import FGL.GameTracker.*;".
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Alan1

  • Posts: 88
Hey Justin. Thanks for the reply. Yup, both Freeform codes already contain

"package FGL.GameTracker"

and I've used "GameTracker" and "GameTrackerErrorEvent" as classnames respectively.

I guess I misunderstood what, "multi-file development platform" meant. I didn't think

"import FGL.GameTracker;"

applied. In any case, I just added it to the top of the Freeform behaviour code but no change. I also placed it in the actor behaviour Create wrapper just for the heck of it, but also no result. It is the Freeform behaviour that, "calls" the GameTracker function, right?
"Oh man, this isn't happening, it only thinks it's happening." ~Flynn

Justin

  • *
  • Posts: 4716
Right, they contain that, but I meant the "package" field in the dialog when you create freeform code.

Quote
you should have an import event with "import FGL.GameTracker;"

Added bold for emphasis, sorry for not explaining clearly.

It should be placed in a "custom imports" event in the same behavior that you have "new GameTracker();". Did Stencyl 2.2 have an import event? If not, forget the import and try "new FGL.GameTracker.GameTracker();"
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Alan1

  • Posts: 88
No apologies necessary. I appreciate any and all help and insight :)

I found the custom import event for the actor behaviour but the Freeform behaviour package field won't accept

"FGL.GameTracker" ("Create" button remains greyed out)

I also tried

"FGL"

with no change from previous results

When I tried

"GameTracker"

I get the error message. I also tried "new FGL.GameTracker.GameTracker();" instead of the custom import event for the heck of it, but no change to either results.
"Oh man, this isn't happening, it only thinks it's happening." ~Flynn

Justin

  • *
  • Posts: 4716
Okay, I set this up myself on 2.2, and I at least got it compiling. I don't know if that means it'll actually work, but here you go.

When you create the freeform code, classname is the same as you've done it, let package just be "FGL", because apparently 2.2 didn't allow multi-level package names. In the code itself, where it says at the top "package FGL.GameTracker" change it to just "package FGL" to match with how you imported it in Stencyl.

In your behavior, have an import event with "import FGL.*;" and then somewhere else the initialization code "new GameTracker();".
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Alan1

  • Posts: 88
Great success! Thank you so much, Justin! I should apologize to you: I probably should've guessed the, "package FGL.GameTracker" needed to be changed accordingly. I managed to get a simple test file working on FGL's servers with some meaningful data, so mission accomplished! If this thread were on FGL's forum board, I'd give you a top score for helpfulness but unfortunately Stencyl doesn't have such a system. Do you have any games you need testing or feedback for? You name it.
"Oh man, this isn't happening, it only thinks it's happening." ~Flynn

Justin

  • *
  • Posts: 4716
Haha no problem, the best repayment would be to make good games and get Stencyl's name out more. Have fun!
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Alan1

  • Posts: 88
Awesome. Thanks again, Justin. I'll certainly do my best  :D
"Oh man, this isn't happening, it only thinks it's happening." ~Flynn