Defining Script Standart?

Gr3yHound

Mr.MapView
Joined
Mar 30, 2004
Messages
396
I´ve never coded python before but i already see it coming.
Soon we´ll have 1000 mods for the gui but you can only use 2 of them without beeing forced to merge them on your own.

This is due to modifications that take place in common files.

So my question is:

Is there a way to make scripts generic?

I play Tribes, a very scriptable ego shooter and what we have is a basic pack that supplies events. So you can write a script/function and attach it to an event. Event´s were declared years ago but everything fundamental is included. Scripts became Plug-and-Play by that. Add them to a list so they´re executed and you got the feature working.
So when the event is called you´re script/function is executed and takes effect.

In civ we could really use such things.

Basicly it would require modifications for almost every .py file Civ was shipped with so we get infos if a screen is loaded,drawn, refreshed, closed or a button was pressed, released, etc. But once done you could write scripts that change syntax etc. that attach to those events and thatfore require no further modifications to the basic file. All little modifications you be inside a seperate folder and could work simultanously.

Example: Maininterface is drawn.
--> change syntax of clock
--> move a few buttons arround
--> create a new hud
--> hide things
--> etc.
--> etc.

i already was civ has events already but as i saw they don´t really suit what´s needed imo.

example from tribes:
EVENT::ATTACH(eventname, Function2beCalled) add´s Function2beCalled to the list what should happen on eventname
Code:
EVENT::ATTACH(eventname, Function2beCalled);
function Function2beCalled(%var, %var2, %var3, ...)
{
//code
}
//this is the support function, modified stock function of the game
Code:
function SomeDefaultFunction(%var, %var2, %var3, ...)
{
...
EVENT::TRIGGER(eventname, %var,%var2,%var3,...);
...
}

the function Event:Trigger would execute all functions that where added (EVENT::ATTACH) to the list of eventname and pass all arguments as defined in EVENT::TRIGGER(eventname, %var,%var2,%var3,...);
now you can run 100000 functions or whatever because they´re been triggered. And the best part is you don´t have to change the basic system, just support a compartible add-on.
 
Back
Top Bottom