Read ZExpression from external file

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Barefists
Posts: 17
Joined: Fri Jan 01, 2016 4:25 pm
Location: Singapore

Read ZExpression from external file

Post by Barefists » Fri Jan 01, 2016 4:35 pm

Hi all,

I've been lurking on these boards while playing with ZGameEditor as a hobbyist for a few weeks, and it's been fun messing around with the components to see what I can come up with.

I was wondering if it might be possible to read ZExpression code from an external file? I'm primarily asking this because while I was trying to come up with procedurally generated content, I used Microsoft Excel and VBS to export data in ZExpression syntax, then manually copy-pasted the generated data into a ZExpression component. I'm not sure if it would be useful for anyone else, but I thought "no harm asking". :)

Thanks for reading!

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

Re: Read ZExpression from external file

Post by VilleK » Fri Jan 01, 2016 6:41 pm

Hi and welcome to these forums!

It is not possible to load code from external file because a ZGE-produced EXE-file does not contain the compiler so it cannot process source code (it only contains the minimal runtime, that's the reason it can be so small).

However it sounds like a cool idea to generate ZGE-source from other tools. Can you show some of your results or just tell us a little more about it? :)

Regards,

Ville

User avatar
Barefists
Posts: 17
Joined: Fri Jan 01, 2016 4:25 pm
Location: Singapore

Re: Read ZExpression from external file

Post by Barefists » Sat Jan 02, 2016 2:25 am

Thanks! I'm still experimenting with it, I'll post here when I get something more concrete! :D

What I meant was, can it compile the referenced external files into the exe? It doesn't have to read the external files anymore after compilation.

User avatar
Barefists
Posts: 17
Joined: Fri Jan 01, 2016 4:25 pm
Location: Singapore

Re: Read ZExpression from external file

Post by Barefists » Sat Jan 02, 2016 2:56 am

Okie a quick example of what I'm trying to do: I wrote a simple VBS that will generate the loading script for Rado1's ZgeSkelet dll based on the files in a directory.

So a directory filled with Cal3D files like this:
Image

Will generate this script in a txt file:

Code: Select all

BlondieCoreModel = zsk_CreateCoreModel("blondie");

// Skeleton
zsk_LoadSkeleton(BlondieCoreModel, "models\\blondie.xsf");

// Animations

// Meshes
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Body.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Bottoms.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_default.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Eyelashes.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Gloves.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Hair.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Shoes.xmf");
zsk_LoadMesh(BlondieCoreModel, "models\\blondie_Tops.xmf");

// Materials
zsk_LoadMaterial(BlondieCoreModel, 0, "models\\blondie_0.xrf");
I will then copy it into the ZExpression component in the zgeproj.
If there were a way I could load this script externally, it would save a lot of the time I spent copy-pasting whenever I did any changes. :D

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

Re: Read ZExpression from external file

Post by Kjell » Sun Jan 03, 2016 1:27 pm

Hi Barefists,
Barefists wrote:If there were a way I could load this script externally, it would save a lot of the time I spent copy-pasting whenever I did any changes.
Unfortunately the only component that ( currently ) supports that is the ZExternalLibrary component. But i agree it would be convenient if you could keep certain resources external during development ( such as images, meshes, scripts etc. ), so you don't have to re-import them every time you make a change.

K

User avatar
Barefists
Posts: 17
Joined: Fri Jan 01, 2016 4:25 pm
Location: Singapore

Re: Read ZExpression from external file

Post by Barefists » Fri Jan 08, 2016 5:07 pm

An alternative would be a XML or JSON parser, would that be possible?

Post Reply