Slightly smarter scripting

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Posts: 78
Joined: Wed Jun 23, 2004 4:07 am
Location: London, England

Slightly smarter scripting

Post by stevesims » Thu Mar 30, 2006 2:56 pm

So I had a thought about scripting many months ago that I never bothered to write down. Several recent posts reminded me of it, so here it is.

The problem:
Some mission OXPs have script variable names that conflict with other OXPs. This can result in mission scripts incorrectly thinking that aspects of missions have been completed, and confusing messages being displayed.

The cause:
Many mission OXP scripts are copied from other OXPs and then the details edited and additions made.

The already suggested solution:
Make sure you name all your script variables uniquely.

The slight problem with the already suggested solution:
There's no convention, so there can still be conflicts, plus new OXP writers have to be aware that they need to follow this convention.

An improved solution:
Separate OXP script variables into different namespaces. This then avoids the problem of conflicts entirely. This merely requires each OXP to have its own unique name.
Provide a mechanism to get variables from other OXP namespaces. This will for example allow for linked OXPs that require you complete the missions from another OXP before you begin the new one.
Ensure that scripts have a "scripting version" identifier, since this behaviour is quite different from the old regime and some older scripts will require variables to work in the old manner.

I'm not familiar with the current script processing engine, but I'd have thought this should be possible, and shouldn't be too tough to implement, even including backward compatibility. It should also make it easier to edit player data files to remove all variables relating to an OXP.

Just a thought. Probably not quite as coherently expressed as it could be - coughing a bit too much at the moment to think very clearly.

Post Reply