ludamad
|
|
Posted on: November 23, 2008, 01:56:12 pm |
|
|
Joined: May 2008
Posts: 1256
|
GML as it is in GM should definitely only be in a special compatibility mode. Instead, the real EDL language should have some more logical restrictions, and better organization of functions.
GM Code:
if variable_local_exists("Counter") { Counter+=1 ds_list_add(myList,Counter) } else { Counter=0 myList = ds_list_create() }
EDL Equivalent //Static variables are used instead, this code can be thought of 'only executing the first time', it is not set to 0 every time it is run
static int Counter = 0;//=0 is optional, in C++ static variables are always initialized to 0 static list myList; //creates an empty list if one is not created Counter++ push(myList,Counter)
|
|
« Last Edit: November 23, 2008, 02:02:29 pm by ludamad »
|
Logged
|
|
|
|
|
|
|
|
|
notachair
|
|
Reply #6 Posted on: November 26, 2008, 12:41:40 am |
|
|
Definitely not a chair
Joined: Feb 2008
Posts: 299
|
But yeah, how about just one forum for discussion plz? At least atm, there really is no need for more. maybe 2. wut >_> <_< <_>
|
|
« Last Edit: November 27, 2008, 04:57:13 am by a2h »
|
Logged
|
|
|
|
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #12 Posted on: November 30, 2008, 12:13:35 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I fear you'll find static doesn't get along with instances. Stays the same after you delete an instance and recreate it.
In other words Abandon all hope.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #14 Posted on: November 30, 2008, 01:31:12 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Well, localv was meant to be used in create, but I could rig static to behave like localv except in constructor. That's only if I have to, though.
Using localv in the create event is virtually the same thing. The create event's been bouncing in and out of the constructor in my mind, but it actually is in the constructor in R3. (It won't be next release, because it'd save time to call it in instance_create instead of checking that we aren't in a room create later. If it's in a room create, I need to make sure all the instances exist before calling create events, I think. I need to run tests...)
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|