Pages: 1 2
Author Topic: Using EDL in LateralGM  (131,520 Views)
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #15 Posted on: May 19, 2016, 06:51:50 PM
You shouldn't have to dynamically allocate your structs, they should work fine allocated the usual way.

The reason you keep getting "enigma::varaccess_amount(int(test))" is because ENIGMA thinks "test" is a normal EDL variable storing the index of an instance, rather than your struct. Robert's trying to get around that by using a pointer, but even then you shouldn't have to dynamically allocate it, just take its address.

It would also be helpful to know which version of GCC you have.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #16 Posted on: May 19, 2016, 07:06:50 PM
After that I went and tested this code again in the create event... and it worked. So it's actually a JDI bug with script locals causing the dot operator to not work. You should not call new, and instead use the following code in events only.

Code (EDL) Select

intStats test;
test.amount = 539;
show_message(string(test.amount));

Offline (Unknown gender) rotenKleber

Member
Joined: May 2016
Posts: 9
View profile
Reply #17 Posted on: May 19, 2016, 11:26:11 PM
Thou art sure?

I added the constructor in definitions
And put this code into a create event

intStats test;
test.amount = 539;


But I am still getting the all familiar error:


.h:43:38: error: invalid cast from type 'itemStats' to type 'int'
     enigma::varaccess_amount(int(test))= 539;


It's as if the period still means nothing to Enigma. And the pointer operator worked not.

So is there a way to get around Enigma treating my struct as a normal variable?
Offline (Unknown gender) TheExDeus

Developer
Joined: Apr 2008
Posts: 1,860
View profile
Reply #18 Posted on: May 21, 2016, 06:15:34 PM
I'm surprised that structs actually work, as I think EDL parser was very far from finished when it was stopped being worked on. I would use structs everywhere if I could.
But in short - EDL != C++. And the things that are written in the wiki about EDL are not entirely true. Those were the planned features. Most of them weren't finished.
Offline (Unknown gender) rotenKleber

Member
Joined: May 2016
Posts: 9
View profile
Reply #19 Posted on: May 23, 2016, 06:01:39 AM
@TheExDeus
Well, they really don't for me, still! But yeah, that would be pretty nice if they did. I'll have to think of a hacky workaround now.
Pages: 1 2