Another round. Awesome coomunity btw.
MWSE is developed kinda heavily
http://forums.bethsoft.com/topic/152794 ... er-mwse-2/
Also newer MWSE 2.0 rewrite
https://mwse.readthedocs.io/en/latest/l ... ction.html
This is gonna be incremental
This esp makes interior cell named aatest. will need overhaul later on.
https://www.dropbox.com/s/a5skbr2o7goab ... t.esp?dl=0
To bypass vanilla file corruption, done in openmw-cs.
Basically needs some structure and need to make rooms for different function groups.
Something activated or distance / global trickered, giving message confirmation if all works.
ideas welcome for something suitable.
- http://www.uesp.net/wiki/Tes3Mod:Catego ... ction_List
- http://www.uesp.net/morrow/editor/mw_cscommands.shtml
- http://wiki.theassimilationlab.com/mmw/ ... or_Dummies
- msfd 9
- http://mwmodders.com/scriptingnotes.html
- https://www.tamriel-rebuilt.org/content ... ng-dummies
Lua was decided to be newscript.
This has been the most debated.
Better documentation in zini's design doc for needed features.
viewtopic.php?f=20&t=5256
- sys::
- script hooks
Scripting rules from Scripting_for_Dummies in vanilla
- inconsistent use of commas can lead to compile errors.
- "If the ID contains a space or begins with an underscore, you must use quotation marks"
- leave a space around parantheses and operators. can cause problems otherwise.
- "a x"-> works but "a x" -> not always like x ->, don't use spaces should work
Safegame corruption crashes in vanilla:
- Loading savegame with outdated modinfo + secondly loading second save with recent info,
seems to notice commas and letters in script, but not numbers
---------------------------------------------------------------------------
getbuttonpressed
Code: Select all
1) Gets the messagebox result starting from 0 for first button
and returns otherwise -1 when messagebox is not open,
https://gitlab.com/OpenMW/openmw/issues/917
results:
- Getbuttonpressed without linked messagebox is supposed to scan messagebox from any script, so any choise as its itself in script is overglowing by design.
- This causes blocking the referred free floating? result on other local scripts.
- Getting getbuttonpressed from messagebox needs mechanism to wait one frame for the info to be processed and useful.
- ie. OnActivate can't be 1 on the same frame as GetButtonPressed is not -1 (from capo)
- Menumode check can be used prevent script execution while in menus ie. activated container, etc.
For above mentioned reasons and one eluded, structure needs to be exactly same as in
http://wiki.theassimilationlab.com/mmw/ ... e_executed
Namely with onactivate:
Code: Select all
short button
short tag
if ( onactivate == 1 )
if tag == 0
messagebox "resharge" "ok then dear" "almsivi allmighty"
set tag to 1
endif
endif
if tag == 1
set button to getbuttonpressed
if ( button == 0 )
player->additem "repair_journeyman_01" 1
set tag to 0
endif
if ( button == 1 )
player->additem "p_restore_fatigue_q" 1
set tag to 0
endif
endif
Otherwise multiple messageboxes in same cell doesn't work as intented
and it's mess
https://gitlab.com/OpenMW/openmw/issues/2676
---------------------------------------------------------------------------
messagebox
-
Spoiler: Show
- In msfd 9 there's a section for messagebox. Variables can be shown with % mark.
Already script defined can be shown with %.ab where
a= number of digits displayed, works for only float, others are ignored
b= ... value type.
- original help D for short, game works with g wiki: "-32,768 to 32,767"
- original f for float, works in game. wiki: "3.4e+38 to 3.4e-38" "7 digit precision"
- in game G for long wiki: "-2,147,483,648 to 2,147,483,647"
- original S for string, not implemented
5) using commas in numbers or D, S, a, t, other letters fails to compile the script ingame
6) is there cases where type is important?
viewtopic.php?f=2&t=2826&start=10
in vanilla switching G/g have no effect on result and the value is read from given variables. Getsecondspassed is given with accuracy upto 15 decimals. rest is zeros.
.x is for decimals:
- g/g, G/g, G/G | a,b,c "a.0d and b.20 with -2e+009"
- g/g | c,b,a "-2e+009 and b.20 with a.0"
- f/f/f | a,b,c "a.6 and b.20 with c.7
Also in vanilla while xg doesn't effect decinals it shows the number of integers, showing vs e+002 etc mark.
Don't know how to test if the value is converted to float and does this matter in mods.
In openmw
- g/f/G "a with b.3" bug.
- g/f/g same
- f/f/f | a,b,c "a.0 and b.3 with c.0" in time zeros are not shown + only tree decimals
tests:
-
Spoiler: Show
Code: Select all
begin messagebox
short a
float b
long c
set a to random 1000
set b to ( b + getsecondspassed )
set c to -2000000000
if ( onactivate==1 )
messagebox " messagebox "%.6g and %.20f with %.7G", a, b, c, "ok"
endif
end
---------------------------------------------------------------------------
enablestatreviewmenu
theory
Code: Select all
1) in vanilla read values directly from played game, buggy, popping up all the inventorywindows.
in openmw same, unbuggy https://github.com/OpenMW/openmw/pull/1257
-
Spoiler: Show
Code: Select all
begin enablestatreviewmenu
if ( onactivate == 1 )
enablestatreviewmenu
endif
end
---------------------------------------------------------------------------
disable / delete
Code: Select all
1) in vanilla disable removes the target from the world but set delete only partially works, calling functions working
before cell reload
2) openmw disable removes target from renders and collision and set delete is straightforward deleting.
---------------------------------------------------------------------------
centeroncell, coc
Code: Select all
1) in vanilla player damage seems to be calculated from end position while in openmw there is a bug causing the start
position come into account https://gitlab.com/OpenMW/openmw/issues/2629 (fixed)
tests:
-
Spoiler: Show
Code: Select all
begin teleportdeath
float timer
;this should cycle trought seyda neen and rethan manor still player is dead from bug
;requires that next line and script is run as every frame global
set timer to ( timer + getsecondspassed )
if ( getpccell "rethan manor" == 1 )
if ( timer > 10 )
player->position -11500 -67800 300000 0
set timer to 0
endif
endif
if ( getpccell "seyda neen" == 1 )
if ( timer > 10 )
coc "rethan manor"
set timer to 0
endif
endif
end
---------------------------------------------------------------------------
Code: Select all
begin teleportdeath1
float timer
;for vanilla test case soltheim is better used
set timer to ( timer + getsecondspassed )
if ( getpccell "rethan manor" == 1 )
if ( timer > 10 )
player->positioncell 100 100 0 0 "solstheim"
set timer to 0
endif
endif
if ( getpccell "solstheim" == 1 )
if ( timer > 10 )
coc "rethan manor"
set timer to 0
endif
endif
end
---------------------------------------------------------------------------
position x y z zrot
Code: Select all
1) consoling player -> position 0 0 32000 0 works in openmw
failsafes to 0 0 ground if underground.
300 000 000 height is possible but results in mesh clipping due to world origin distance
in vanilla, console takes only x,y,zrot values and defaults on ground
position -1000 -70000 (any value) 0 teleports as intended near seyda neen but at the z height of 1000
test: defaulting to ground on actors, statics
test for variables: works
-
Spoiler: Show
Code: Select all
Begin sj_aplacement
float x
float y
float e
set e to (player->getpos z) + 10
set y to (player->getpos y) + 100
set x to (player->getpos x) + 100
"hannabi zabynatus"->position x y e 0
End sj_aplacement
---------------------------------------------------------------------------
positioncell
---------------------------------------------------------------------------
GetPCTraveling and GetPCInJail
both returns 0 in one frame after new cell is loaded
https://github.com/OpenMW/openmw/pull/1868
testing script by
LennyPenny
https://upl.io/i/4ct8te.mp4
-
Spoiler: Show
Code: Select all
Begin aaa_cellchange_frame_test
short pew
float lastx
float lasty
float lastz
float nowx
float nowy
float nowz
if (getPCtraveling == 1)
set lastx to (player->getpos x)
set lasty to (player->getpos y)
set lastz to (player->getpos z)
set pew to 1
endif
if (pew == 1)
if (getPCtraveling != 1)
set nowx to ( player->getpos x )
set nowy to ( player->getpos y )
set nowz to ( player->getpos z )
messagebox "pos now: %.2f %.2f %.2f" nowx nowy nowz
messagebox "pos before: %.2f %.2f %.2f" lastx lasty lastz
set pew to 0
endif
endif
End aaa_cellchange_frame_test
---------------------------------------------------------------------------
startcombat, stopcombat
use cases
- targeting file placed references
- console placed references (doesn't work in vanilla)
- script placed references
- unigue references from base game
- local script
- global script
- dialogue results
- interaction with setfight
-
Spoiler: Show
-
simple local script
Code: Select all
Begin aaacombattestlocal
short done
if done=0
startcombat aaanina
set done to 1
endif
End aaacombattestlocal
global targeting
scripted fight
---------------------------------------------------------------------------
random
Code: Select all
1) before bloodmoon patch unreliable on small numbers. in openmw c++ generators
2) in vanilla seems to fire about 20 times a frame while in openmw once every frame
3) should work with operators if ( random 20 == 10 )
test:
-
Spoiler: Show
Code: Select all
begin testrandom
short a
short n1
short n2
short n3
short n4
set a to random 3
if ( a == 0 )
set n1 to ( n1 + 1 )
elseif ( a == 1 )
set n2 to ( n2 + 1 )
elseif ( a == 2 )
set n3 to ( n3 + 1 )
elseif ( a == 3 )
set n4 to ( n4 + 1 )
endif
endif
endif
endif
if ( onactivate == 1 )
messagebox "%.0g, %.0g, %.0g, %.0g" n1 n2 n3 n4
endif
end
---------------------------------------------------------------------------
for scripts + testing mods
possibly cross referencing scripting systems in the future
-
Spoiler: Show
Code: Select all
Begin aaaactivationtimes
short n
if ( onactivate == 1 )
messagebox "%g" n
set n to n+1
endif
End aaaactivationtimes
related to
https://gitlab.com/OpenMW/openmw/issues/999
ungategorized scripts:
-
Spoiler: Show
Code: Select all
Begin aaagetdistancemes
float g
set g to getdistance player
if ( getdistance player < 1000 )
messagebox "%g" g
endif
End aaagetdistancemes
msfd 9 on the table
test scripts, structures are more than welcome : )
also advice on formatting.
-
Spoiler: Show
- changelog:
added lines
corrected syntax
getbuttonpressed and random scripts
getbuttonpressed bugtracking
%.xg behavior in vanilla + random gen rates
disable / delete
redits:
nakashi for syntax advice.
asmo for general bugtesting initiative.
in openmw for patience.
bugtesters and modders on openmw and vanilla side for ideas.
msfd 9 and who have contributed to manuals over the years.
who all are clearly too numerous to list here.
controversial but thanks for bethesda for buggy engine what have driven players mad enought to write a new engine and stay on modding
and for the great game.
Documentation also partially in here
https://github.com/sjek/scripts-workspace