-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script updates and fixes #3197
Script updates and fixes #3197
Conversation
changes made: * added `*_utils` namespaces (new convention for includes) * unified style of scripts: using global variables and functions instead of classes. * scripts auto-formatted by script_editor.as
This reverts a line from caf88e5 - I wanted to be purist and force users to do `engity.getSubEntities(0).setMaterial()` but since OGRE has this convenience method and the skeletal posing example already uses it, let's just roll with it.
Returns `array<Ogre::MovableObjects@>` in no particular order; works using bounding boxes so large/generated meshes like roads get matched all the time. comes with example script.
drawSelectableFileList() now Creates a child window with dynamic height (but clamped to hardcoded max value). const int MAX_CHILD_HEIGHT = 300; const int CHILD_WIDTH = 600;
Also fixed typos in `get/setCameraOrientation()` function bindings - parameter was declared as `vector3`, should have been `quaternion`. Also fixed weird binding of global `game` object, preventing use of AngelScript delegates. Fixed to bind as non-counting reference because that's the sensible choice.
When loaded with a terrain containing races, it detects them and generates race-def files for each of them, also modifying the .terrn2 file. These files can't be processed yet, but they contain all info normally present in the race definition scripts. Example from Auriga: ``` ; ~~ New 'race-def' format (file extension: .race). ~~ ; Each race file specifies a single race ; In .terrn2 file, list the race files under new section [Races] ; Filenames must include extension and end with = (like scripts do) ; Race system supports alternating paths! ; Checkpoint format: checkpointNum(1+), altpathNum(1+), x, y, z, rotX, rotY, rotZ, objName(override, optional) ; By convention, the checkpoint meshes are oriented sideways (facing X axis) race_name 1 kilometer drag race_laps 0.000000 race_checkpoint_object 31-checkpoint race_start_object 31-checkpoint race_finish_object 31-checkpoint begin_checkpoints 1.000000,1.000000,1010.000000,9.000000,505.000000,0.000000,90.000000,0.000000 2.000000,1.000000,10.000000,9.000000,505.000000,0.000000,90.000000,0.000000 end_checkpoints ```
43cca19
to
5ee84b4
Compare
Since adding INT/FLOAT and removing NUMBER token types from GenericDocument, all copypasted viewers/editors in scripts are broken. This is 1st step to creating an unified viewer/editor as include, but not yet there.
Implements `GenericDocEditor` which doesn't edit yet but has highlight+selection and can be shared by scripts. Currently only 'example_terrn2_raceConverter.as' was updated to use it.
terrnBatcher coding style matched others. rigEditorAlpha updated to use 'genericdoc_utils' 3 scripts renamed - category changed for clarity.
also removed one Float->Int compiler warning
Tooltips were polished: brighter title, no more "Title:" and "Brief:" prefixes, separator moved under title+brief
FIXME: this example was created for Tritonas00's sky shader which was later reverted.
Crashes on me under Win10, DirectX9 although used to work OK... I added a lot of checks and buttons to test slow, at one point it worked but then stopped again... crashes somewhere in OGRE overlay system, I can't easily debug at the moemnt, so I'm just posting the updated script.
5ee84b4
to
c2ab86c
Compare
Tested all scripts in The following scripts fail or throw warnings:
Guaranteed game crash almost every time. Log warnings:
Fails if no races are present on terrain, otherwise OK
Loads with warnings:
Doesn't advance past step 0, even with a vehicle spawned. Removing vehicle gives 'out of bounds' error:
OK with warning:
Spammed log with 'out of bounds' error first time, have yet to reproduce again (with or without vehicle spawned)
All other scripts appear to load OK 👍
|
d764e5e
to
60db491
Compare
Changes: * added + registered `enum ScriptRetCode` - used by all script manipulation funcs (add/get/delete | funcs/variables) * added func `scriptVariableExists()` to go with `scriptFunctionExists()` * added internal helper `validateScriptModule`- used by all script manipulation funcs (add/get/delete | funcs/variables) Following is analysis of former state (most but not all funcs returned 0 on success) ~ executeString() [script: not exported] - used to return 0 on success, 1 on internal error and negative number otherwise. ~ addFunction() [script: `game.addScriptFunction()`] - used to return 0 on success, 1 on internal error and negative number otherwise. ~ functionExists() [script: `game.scriptFunctionExists()`] - used to return function ID (always >0) on success, negative number on error. ~ deleteFunction() [script: `game.deleteScriptFunction()`] - used to return function ID (always >0) on success, negative number on error. ~ addVariable() [script: `game.addScriptVariable()` ] - used to return 0 on success, 1 on internal error and negative number otherwise. ~ variableExists() [script: `game.scriptVariableExists()`] - newly added, returns 0 on success and negative number otherwise. ~ deleteVariable() [script: `game.deleteScriptVariable()` ] - used to return 0 on success, 1 on internal error and negative number otherwise. ~ getVariable() [script: `game.getScriptVariable()` ] - recently added, returns 0 on success and negative number otherwise.
60db491
to
a078c21
Compare
@CuriousMike56 Thanks for such an elaborate test. Everything should be fixed now. Please also test if races/AI work normally because I've done changes across the entire scripting subsystem - I had to unify return codes of functions because it was an undocumented mess:
|
Fixes #3195 - apparently I forgot to fix some scripts after I fixed the [X] button in 41060b8
I'm in the process of going through the scripts, making sure they work and they use all capabilities offered by the game. For example I added tabs to the road editor since those arrived in the meantime.