Pages: « 1 2
  Print  
Author Topic: Using EDL in LateralGM  (Read 2292 times)
Offline (Male) Rusky
Reply #15 Posted on: May 19, 2016, 01:51:50 PM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
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.
Logged
Offline (Male) Goombert
Reply #16 Posted on: May 19, 2016, 02:06:50 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3151

View Profile
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));
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) rotenKleber
Reply #17 Posted on: May 19, 2016, 06:26:11 PM

Member
Joined: May 2016
Posts: 9

View Profile Email
Thou art sure?

I added the constructor in definitions
And put this code into a create event
Code: [Select]
intStats test;
test.amount = 539;

But I am still getting the all familiar error:

Code: [Select]
.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?
« Last Edit: May 19, 2016, 06:51:51 PM by rotenKleber » Logged
Offline (Unknown gender) TheExDeus
Reply #18 Posted on: May 21, 2016, 01:15:34 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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.
Logged
Offline (Unknown gender) rotenKleber
Reply #19 Posted on: May 23, 2016, 01:01:39 AM

Member
Joined: May 2016
Posts: 9

View Profile Email
@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.
Logged
Pages: « 1 2
  Print