Hi!
I got an error, when tried to implement a struct into my code. I followed an example from
https://enigma-dev.org/forums/index.php?topic=2674.msg25861#msg25861, where this example worked on Goombert's computer. In Definitions I created a struct
struct circle {
var x = 0, y = 0;
double radius;
double get_area() { return pi * radius * radius; } // Simple method
circle(double r = 1) { radius = r; }; // Optimizing this falls on the language plugin
~circle() { }
};
Script
///test_circle()
circle *test = new circle();
test.x = 200;
show_message(string(test.x));
In the o_game Create event
test_circle();
And in the Cleanup
delete test;
This is an error:
Syntax error in script `test_circle'
Line 3, position 26 (absolute 45): Unknown function or script `circle'
Then I put the code from script directly into the create event and the error is the same:
Event[0, 0] Check `o_game::create...Syntax error in object `o_game', Create event:0:
Line 4, position 26 (absolute 64): Unknown function or script `circle'
What's wrong in my code?