Creating an Extension. [Problems encountered]

iterbi7

  • Posts: 5
Hello everyone.

First I would like to apologize If I put this topic in the wrong thread.  ::) Second, I came here to ask for help because I ran into some problems creating my first Stencyl extension and I really hope someone could help me with this.

So, I want to create a very simple extension and I was going through a tutorial found here: http://www.stencyl.com/help/view/creating-extensions/. I will tell exactly what I did at every step found in link above, so you can tell me where I messed up.

First I've downloaded Stencyl Extension SDK.
Then've followed the instructions:
1. " First, navigate to [STENCYL_FOLDER]/plaf/sw/ - This folder contains all of your extensions."
I did but I think this step is a little outdated? Because In my stencyl installation directory I don't have any "sw" folders inside "plaf" directory. (Check the screenshot)



2. "Open up the Sample Project in your IDE by creating a new, existing project. Peek at the README, which contains specific instructions for the nitty gritty project setup. Add sw.jar to the project's classpath and edit build.xml as directed."

I've done that. I put Sample Project into existing workspace and Eclipse recognize it without problems when I give it the same name when creating "new java project".  My package explorer in Eclipse looked like this (no errors):



Going futher I edited the build.xml file as directed:
1. "value" of "property" name="name" is the same name as the main class. So in this case "SampleExtension".
2. "value" of property  name="swworkdir" is the workspace of stencyl. I've checked it where it is under Stencyl-> File ->Preferences->Workspace -> Workspace Folder. I copied that location and paste it in build.xml file. Also I've added value to "srcdir" which is a path to my java compiler ( without this It wouldn't sucessfully build .jar file )

build.xml now looks like this:


3. After that is done, run the "dist" ANT task. This builds a JAR file that Stencyl recognizes as an extension.

I did and it build sucessfully. Here is the screenshot:



In this stage .jar file was created in "C:\Users\Matej\AppData\Roaming\Stencyl\stencylworks\extensions" with name SampleExtension.

4. Launch your copy of Stencyl, and you will see the Sample Extension appear in the Extensions menu and also inside the Extensions Manager. Play around with it.

I launched Stencyl and Sample Extension DID NOT appear in the Extension Manager.



So the questions is: What Am I doing wrong that Extension would not appear in the Extensions manager? Another question which I have is: What is the difference between Toolset Extensions and Engine extensions. What you can do with one of each? Can you make the Google+ Extension (+1 button) with toolset extension?

I also have all the required specifications needed:

1. Stencyl 3.1
2. Java JDK 6 (jdk1.6.0_45)
3. Eclipse IDE

Any help REALLY appriciated. Have a nice day  :)






mdotedot

  • *
  • Posts: 1492
Hello iterbi7,

Could you tell us what you want to achieve with the extension?
The steps you are following are indeed outdated and are for extensions that are for the Stencyl GUI instead of extensions to be used in applications.
If you for example want to include blocks in the panel to do something with text for instance then you would need to create an engine-extension.

You can find engine-extensions in your home directory under stencylworks/engine-extensions.
Take a look at the code in tileapi if you want to make similar blocks available in Stencyl.

Engine-extensions are written in HaXe and the Stencyl (GUI) extensions are written in Java as far as I know. Personally I don't have experience with Stencyl Extensions, but I made a few engine-extensions and can help you out!

Please tell us what you want to accomplish with the extension!

Best regards from
M.E.

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

captaincomic

  • *
  • Posts: 6109
Check your logs, or post them here. If the jar was created but doesn't show up, maybe there's an error in the logs.

Regarding Toolset vs Engine extensions. Toolset extensions add functionality to the Stencyl IDE, while engine extensions add new blocks to the palette. The easiest way to see the difference is by looking at existing extensions.

iterbi7

  • Posts: 5
I thank both for the answer.

There are two things I would like to accomplish:
1. I would like to make Google Plus (Google+) extension (from existing Android class) . So people in my game would click the "+1" button and thus recommend Google my product.
2. I would like to learn how to make Stencyl extensions ( I know Java ) and develop more extensions for this awesome tool.

Check your logs, or post them here. If the jar was created but doesn't show up, maybe there's an error in the logs.

Do you mean LOG in Eclipse? In the console window it shows that everything is okay.




rob1221

  • *
  • Posts: 9202
1. I would like to make Google Plus (Google+) extension (from existing Android class) . So people in my game would click the "+1" button and thus recommend Google my product.
For this you'll want to make an engine extension, not a toolset extension.

captaincomic

  • *
  • Posts: 6109
I'm meant Stencyl's logs (Debug -> Logs -> Generate Logs).

iterbi7

  • Posts: 5
Hello, me again :)

I've sucessfuly created my first engine extension +1 (PlusOne) button. I did this by editing the extisting engine extension "test-native" found in Stencyl folder.  I removed the old code and put the creation of the PlusOne button in the "run" method of the NativeTest.java file.

It works, but I'm not satisfied because I need feedback when the user interacts with the +1 button.  I can implement the onPlusOneClickListener and it works (potential click is detected), but in that code I need to use startActivityForResult(intent, 0) - it is required. When the user interacts with button the +1 confirmation dialog popus up and it asks the user if he wants to "Cancel", "Share", or "+1". Originally I would overrode the "onActivityResult" method in my Activity (Because the original activity "listens" for potential feedback from previously started activity ) and thus get the result, but I don't know where to implement that method when dealing with haxe and stencyl. Where is activity lifecycle handled anyway.. and in where are handled such methods like "onActivityResult", and others?

I hope you understand what I asked :) Thank you for your answer.