Troubleshooting Expression in Plugin

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Apr 23, 2011 3:53 am

I just built-up the example plugin to get started learning how to write these. Everything compiled fine and I was able to load the plugin with Construct.

Then I followed all the steps in the tutorial to build the color gradient plugin with the setcolors actions and getcolor expression. The problem is when I select "Get Color" from the expression box nothing happens and the window just closes. Any ideas on what I'm doing wrong? I can't find any mistakes in the code.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Apr 23, 2011 7:43 am

it might have something to do with ACETABLE.cpp, if you paste the code I can tell your for sure if it does, just the part relating to that expression. If it is the problem, you can probably figure out from this: the ADDEXP relating to the get color, check number 3 below, but here's a breakdown on the others as well, I don't remember if the tutorial went in detail:

[size=85:3scnhft6]
[code:3scnhft6]ADDEXP("My expression", "My category", "MyExpression", &ExtObject::eMyExpression, RETURN_INTEGER);[/code:3scnhft6]
[/size:3scnhft6]
[list=1:3scnhft6]
[*:3scnhft6]"My expression" should be what you see when in the Add Expression dialogue in the editor
[/*:m:3scnhft6]
[*:3scnhft6]"My category" is the category it's under
[/*:m:3scnhft6]
[*:3scnhft6]"MyExpression" is what you actually have to type to use the expression, like "Angle" is what is here in the sprite plugin's sprite.angle expression. not case-sensitive. Checking if this is an empty string is probably where I'd first look, or if it was invalid with a space or something that wouldn't work in construct.
[/*:m:3scnhft6]
[*:3scnhft6] &ExtObject::eMyExpression is a pointer to the c++ function that actually returns the value at runtime for this expression
[/*:m:3scnhft6]
[*:3scnhft6] RETURN_INTEGER is the return type of the c++ function. RETURN_STRING, or RETURN_FLOAT are two more valid constants, if you right-click - go to deceleration in visual studio on any one of these, you can see a full list.[/*:m:3scnhft6][/list:o:3scnhft6]

if it's not this, it's probably not to do with the ace_table, but I'd suggest checking number 3 before moving on to other troubleshooting
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Apr 23, 2011 1:01 pm

Thanks Lucid for the details. Unfortunately, everything still looks ok. On a separate note, I am getting an error when building for release mode (something about:
ConstructSDK.def : error LNK2001: unresolved external symbol GetInfo
Release/ConstructSDK.lib : fatal error LNK1120: 1 unresolved externals

The whole debug/runtime/release mode settings for output and linker confuse the heck out of me. I still get a warning about output path being different than linker path even though they all seem to be the same. It compiles fine under the "Debug" build option.

I zipped up the relevant source files if you have time to take a look:
http://www.box.net/shared/dmdy4r6qta

I'm at a loss at this point how to debug this. Is there a way to be able to debug the execution of this plugin?
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Apr 23, 2011 4:25 pm

Think I might be narrowing down at least the runtime/release build error for GetInfo.

In internal.hpp the function is defined, but it has this config macro
// EDITTIME
#ifndef RUN_ONLY

And the function below is grayed out.

void WINAPI GetInfo(LPOINFO objectInfo)
{
objectInfo->MinimumVersion = MINIMUM_VERSION;
objectInfo->ideFlags = IDE_FLAGS;
}

Still not sure why it compiles fine under debug mode.

What does it mean in Visual Studio when there is a tiny little red circle with a minus sign sitting over the file name in the solution explorer? I'm using Visual Studio Pro 2010 and the project I coverted over was the MFC visual studio 2005 solution.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Apr 23, 2011 5:44 pm

ok, i figured out the problem with the plugin. It might have just been a stupid error (not selecting "use expression") but I now successfully am using it. :oops:

Still having the problem with building in release mode. The runtime portion of the plugin is still getting an error as mentioned below.

p.s. Are there any instructions on debugging a plugin at runtime?
B
8
S
3
G
7
Posts: 835
Reputation: 5,313


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 1 guest