Zotscript Lives!


skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,070
Website
www.codejedi.com
(Okay, not that anyone cares :p)

Its quite capable (you can declare functions, constants, variables, and call Zot-provided functions); its vaguely C and Pascal-like so should be mediumly hard for people to use.

I'm still bulkding interfaces into Zot and building ot-functions into its callable function list, but right off the top it can do neat stuff without using zot functions..

In the games config, for the InitGame call, one could for instance add this script:

gp_showoff() {
return ( pow ( 3,2 ) * 2 );
}

/* returns x raised to the power of y */
pow ( x, y ) {
assert y >= 0;
new r = 1;
for (new i = 0; i < y; i++) {
r *= x;
}
return r
}

Then in the config you could anytime you want call gp_showoff() and it'd return 18 (3 to the power of 2, times 2), or just call "pow(3,3)" to get 9, or the like. No work from Zot needed since you defined it in your own script!

I'm so stoked this damn thing works after all this time :)

This will be crazy useful if I build it into the system, but doing so is a tonne of work, since really, half the config system should be rewritten and redesigned around this.

ie: I could put the main render loop as script call instead of built into the game, then you'dbe able to render anyway you like. It'd slow things down to move it to script, but it'd definately allow one to script Zot to do damned near anything :p

Likewise.. I need to adjust it so when a sprite gets impacted by anpother sprite, it calls a script in the receiver, so you can respond however you like.. rather than making you define "triggers" and "events" and all that stuff as it does now.

Also, let you script the AI's perhaps, rather than use built in ones.

Each script would slow it down, and I'm not sure a Zodiac or GP32 is powerful enough to run a few dozen scripts per frame and still keep the framerate up, but its damned cool anyway, and will be fun to see.

(For gp32 folks.. this could be a cool alternative to Fenix if I get enough time into it :)

The only downside is right now the compiler for the scripts is desktop-only; I could make a web based one, too. I think in practice I'll try and port the compiler into Zot itself, so that as it encounters scripts it'll just compile them on the handheld itself, and not worry about pre-compiling them... this would add to the coolness and mean you could edit the scripts right on the device.

So much to do, but .. so cool :)

jeff
 
Thanks for the great work Skeezix. Too bad I am so completely retarded when it comes to programming but hopefully someone with the skillz will be able to use it.
 
That does sound powerful. and would be a great option for the coders around. Possibly a little too difficult for the non-coders, who like triggers and events :)
 
Well, being Zot, no one really picked it up so thats moot ;)

But in case you're curious..

The trigger system was like this..

sprite one
...
sprite end

sprite two
...
sprite end

trigger *
when-collide one two
action damage
trigger end

action damage
variable-sub health 10
action end

Once I get the interpreter more integrated it'll be like this likely:

sprite one
...
when-collide local
if ( get_sprite ( from ) == sprite ( "two" ) ) {
get_var ( "health" ) -= 10; // deal 10 damage
}
when-collide end
...
sprite end

So as you can see it gets "shorter" and definately more powerful. Its a little more complex, though most people wouldn't have to know too much.

Hell, if it got useful, someone could just write up a library of common functions and make a default config people could modify.. then just swap graphics, change rules, and away you go..

jeff
 
Zot!
patbrain.jpg


(Sorry Jeff, been wanting to do this gag for a while ;))
 
Sounds like it's going in a cool direction!
I hope it becomes realized gp32_console

Ummm ...
skeezix posted on up a bit! said:
or just call "pow(3 at 3)" to get 9
Looks like there's a bug! 3 to the 3 is 27! :D :lol: :)

Oops! Sorry! I just slipped into my pedants pants :eek:
 
Last edited by a moderator:
doh ;) Late-night-math always works out differently than day-time-math :p Be careful to run the program during the day :p

The script interp works on all zot platforms already.. just need to bring over the compiler so that things are easier, and then tie it into the system (add functions to the interp for loading images, manipulating maps, etc.)

jeff
 
I may need to look into this once I get the time.. I've been wanting to get into coding for the GP32 but I don't know ARM-ASM and don't really want to have to learn a new coding launguage such as fenix. But I do already know most of the C/++ basics!
 
Back
Top