Page 1 of 1

Periodic and Event Based Script Execution

PostPosted: Mon Oct 09, 2006 3:45 pm
by daenerys
Hello,

is it possible to implement some kind of interrupt handle for the scripts? E.g. it would be nice if there would be a possibility for executing a script for e.g. every x miliseconds.

Another even finer thing would be the script execution based on changes in memory, similar to the debugger interrupts.

Is this possible? If yes, this would be awsome :shock: :) :D 8)

PostPosted: Mon Oct 09, 2006 5:42 pm
by L. Spiro
Both are possible and planned.

But neither can be added yet as both rely on other parts being completed.



When ready, I will add a SetTimer() to allow you to call functions periodically as you desire.
However, to ensure that people can use this safely I have to add the “synchronized” keyword to the scripts.

This word is borrowed from Java and Java pros will know already what it does.
It allows you to define sections of code that can only be executed on one thread at a time, which is required for safe threading if you spawn function calls with SetTimer().

At the same time as I add SetTimer() I will also add a function that allows you to simple spawn a new script thread to execute simultaneously with your current thread.
This of course requires synchronized.




As for responding to changes in the target memory, this requires the debugger be finished as it will use breakpoints to call the events.
It will use the same method as exists now, where you can assign functions to breakpoints, but in this case you will assign a script function to the breakpoints.
So to call a script function when something changes, you would simply set a write breakpoint and assigne your script function to it.

Then of course you can do anything you desire in the script before allowing the game to continue.


But because of the current state of the project, these things will be a ways off for now.


L. Spiro

PostPosted: Tue Oct 10, 2006 2:45 am
by daenerys
Thanks man.

Err, what is the state of the project? Did I miss something?

PostPosted: Tue Oct 10, 2006 10:32 am
by L. Spiro
The state of the project is “started over”.

You can get the demo in the General section.


No hotkeys, no hex editor, no debugger, no disassembler, etc.


L. Spiro

PostPosted: Wed Oct 11, 2006 5:58 pm
by daenerys
Oh :o ,
I think I will stick with the old versions then...