Scripting enhancements

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Scripting enhancements

Postby VilleK » Fri Aug 10, 2018 7:11 pm

Some small improvements and bugfixes to scripting:

1. Function overloading.
Now it is possible to declare multiple functions with the same name as long as the argument count differs.
Example:

Code: Select all

float max(float x, float y) { ... }
float max(float x, float y, float z) { ... }
float max(float x, float y, float z,float w) { ... }


2. Library initialization.
It is now possible to have blocks of code in ZLibrary that is executed during library initialization.
Example:

Code: Select all

private int[10] lookup; //declare lookup table
 
{ //Initialize table
  for(int i=0; i<lookup.SizeDim1; i++)
    lookup[i] = ...
}

void getLookup(int index) { //function that uses the lookup table
  ...
}

You can have multiple such blocks and they will run in succession.
Limitation: the ZLibrary must be located in App.OnLoaded to use initialize-blocks.

3. Library variable default assignment.
It is now allowed to give a library variable a default value (just like local variables).
This was previously not allowed in libraries.

Code: Select all

private int xx=42;
private string s="Hello";

Limitation: the ZLibrary must be located in App.OnLoaded.

4. Missing operators from C/Java now implemented
"~" : binary not. "int x = ~0xF0;"
"!" : unary not "int x = !y;" (x will be 0 if y is 0 else x will be 1)
"|=" : binary or assign
"<<=" : binary shift left assign
">>=" : binary shift right assign
"&=" : binary and assign

5. "do while".
Do-while loops now supported. These loops execute at least one iteration.

Code: Select all

int i=0;
do {
  ...
} while (i<5);


6. Nested blocks now have scope
Previously there was a bug that caused the code below to fail to compile because x is declared twice, even though they are in separate blocks. That is now fixed.

Code: Select all

void f() {

  {
    int x=1;
  }

  {
    int x=1;
  }

}


7. MRU list in editor extended to 16 items.
The list of most-recently-used projects in the File menu has now been expanded from 8 to 16 items.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip

User avatar
Ats
Posts: 131
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Scripting enhancements

Postby Ats » Sun Aug 12, 2018 11:31 am

Hi Ville,

I've updated ZGE to the latest release and I have a weird error:

Error in expression for node: ZExternalLibrary opengl32 External functions definitions can not have a body: __f

In order to make it work, I have to completely remove those lines of code in ZExternalLibrary ModuleName:opengl32 BeforeInitExp:
if(ANDROID) { this.ModuleName = "libGLESv1_CM.so";
} else { this.ModuleName = "opengl32"; }

Then opengl32 calls still works on PC (why?) but are completely broken on Android.

Edit:
I have another trouble: when I compile for Android, the last little windows that says that everything went fine now appears very small so no buttons can be pressed, you can only press enter to close it.

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Sun Aug 12, 2018 12:34 pm

Hi,

First problem should be fixed now, please download and try again.

About small messagebox, I don't know what could cause that. Can you show a screenshot?

User avatar
Ats
Posts: 131
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Scripting enhancements

Postby Ats » Sun Aug 12, 2018 2:42 pm

Thanks for the fix :)

The small window in still here. It was working perfectly just before I upgrade ZGE this morning.
I even tried to supress ZGameEditor.ini file.
Here's the screenshot:

http://i68.tinypic.com/2wp1qv5.png
(BBCode is OFF in this topic)

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Sun Aug 12, 2018 3:50 pm

That's very odd. What about the dialog after choosing "Build and compress Windows exe file", does it look the same?

User avatar
Kjell
Posts: 1648
Joined: Sat Feb 23, 2008 11:15 pm

Re: Scripting enhancements

Postby Kjell » Sun Aug 12, 2018 6:11 pm

Hej Ville,

Very nice updates, especially function overloading ( even though it's not part of the C spec ) is a welcome addition :) By the way, i noticed that the unary negation operator suddenly works on variables! Did that get fixed recently?

K

User avatar
Ats
Posts: 131
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Scripting enhancements

Postby Ats » Mon Aug 13, 2018 7:06 am

"What about the dialog after choosing "Build and compress Windows exe file", does it look the same?"

It's the same. I recall I have installed a Microsoft Visual Basic 6 package recently (https://www.microsoft.com/en-us/downloa ... x?id=10019)
Maybe this have to do with that problem ? I'll try to remove it (but it's not in the uninstall list...)

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Mon Aug 13, 2018 7:54 am

Kjell wrote:By the way, i noticed that the unary negation operator suddenly works on variables! Did that get fixed recently?


Indeed, this was also added in this revision but I forgot to mention it.

@Ats: It might be related, yes. Have you rebooted your computer after installing the VB-extensions? Do you have an older version of ZGE to try if the dialog works there?

User avatar
Ats
Posts: 131
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Scripting enhancements

Postby Ats » Mon Aug 13, 2018 8:20 am

"Have you rebooted your computer after installing the VB-extensions?"
Yes

"Do you have an older version of ZGE to try if the dialog works there?"
I don't have the zip file anymore. But I can recover the files from dropbox. What files should I revert other than ZGameEditor.exe ?

Edit: This only happens on the PC that got the VB-Extensions. So it's must be that.

User avatar
Kjell
Posts: 1648
Joined: Sat Feb 23, 2008 11:15 pm

Re: Scripting enhancements

Postby Kjell » Mon Aug 13, 2018 12:03 pm

Hi Ats,

Visual Basic 6 is absolutely ancient ( it's from 2005 ) .. i suspect ZGE attempts to use a feature ( DPI-aware scaling perhaps ) that isn't supported by the run-time files provided by VB6. I recommend using a virtual-machine running Windows XP for Visual Basic 6 based projects instead.

+ The run-time situation in regards to development environments can be absolutely ghastly at times on Windows. For instance, i have to be careful not to install any recent version of .NET as it'll render my Visual Studio setup inoperable ... and since a lot of application installers automatically install .NET frameworks without warning, it can feel like a minefield out there :shock:

K

User avatar
Ats
Posts: 131
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Scripting enhancements

Postby Ats » Mon Aug 20, 2018 10:19 am

Yeah, I didn't realize that 2005 was that old until now... :(

I've found another problem with this new version of ZGE: exporting an image doesn't work anymore.
viewtopic.php?f=1&t=1156&p=8723#p7242

The FrameBuffer seems to be ok with glReadPixels. But the exported file is 0 Ko...

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Mon Aug 20, 2018 3:57 pm

Ats wrote:The FrameBuffer seems to be ok with glReadPixels. But the exported file is 0 Ko...

Indeed, I'll fix it. Thanks for reporting.

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Mon Aug 20, 2018 6:17 pm

Ok, the bug that caused the export image project to fail is now fixed.

Also in this build is an optimization to switch-statements. Switch statements using integer expression now uses optimized jump table so the code runs faster.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip

User avatar
rrTea
Posts: 320
Joined: Sat Feb 15, 2014 9:54 am

Re: Scripting enhancements

Postby rrTea » Tue Aug 21, 2018 2:45 am

The newest build refuses to start on my computer. I am getting this error:
https://archive.org/download/ShowFlow/4.png

The previous build still works fine.

User avatar
VilleK
Site Admin
Posts: 1920
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Scripting enhancements

Postby VilleK » Tue Aug 21, 2018 11:26 am

rrTea wrote:The newest build refuses to start on my computer. I am getting this error:
https://archive.org/download/ShowFlow/4.png

The previous build still works fine.

Strange, it must encounter an error while trying to open your last opened project? Is it possible for you to send this project to me? You can PM if you want.


Return to “Releases”

Who is online

Users browsing this forum: No registered users and 0 guests