Scripting - Once Again

Everything about development and the OpenMW source code.
User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Scripting - Once Again

Post by Zini » 14 Jul 2014, 16:10

I will be starting another pass over the scripting implementation this week. Hopefully the last one before 1.0.

This will only cover problems with the scripting engine itself (compiler and VM). I will not handle missing script instructions. It would be highly appreciated, If we can find some volunteers for these. Some of the missing instructions have issues filed on the tracker and there is also a list on the wiki.

I meant to post a research request for this issue, but scrawl was faster. Still, I might come up with more research request during this task and here help would be very welcome too.

User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini » 15 Jul 2014, 09:34

Back to the issue mentioned above. At first I got a small panic attack from that. If interpreted in the widest scope this feature would break several basic assumption about our world model. But it is probably not that bad. I assume this works only reliably for unique IDs (i.e. IDs that are referenced only once). If there are more then one reference for the ID with the implementation I have in mind, it would not be guaranteed that a targeted script would run on the same reference every time. If MW does provide this guarantee and if you can find any case where a content file relies on this behavior, please speak up. I will hate you, but you should speak up anyway.

Also, we need even more research:

- Can the same object have multiple targeted scripts running at the same time?
- Can the same targeted script run on multiple objects at the same time?
- Can the same script run as a targeted script and a global script at the same time?

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl » 15 Jul 2014, 11:21

Here goes another test session.
- Can the same targeted script run on multiple objects at the same time?
No. Attempting to start the same script on a second object appears to be a no-op.
- Can the same object have multiple targeted scripts running at the same time?
Yes.
- Can the same script run as a targeted script and a global script at the same time?
No. Attempting to start a targeted script that is already a global script is a no-op. Same as attempting to start a global script that is already a targeted script.
I assume this works only reliably for unique IDs (i.e. IDs that are referenced only once).
Confirmed. I was able to start separate scripts on two references of the same ID, but after saving and reloading the game, only the first reference still had a script running.
Last edited by scrawl on 16 Jul 2014, 09:32, edited 1 time in total.

User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini » 15 Jul 2014, 11:24

One more issue (I vaguely remember this being mentioned before, but I can't find any references to it). The getDisabled function works either with an implicit or an explicit reference. However in the default content files I also find this function with an addition argument (e.g. GetDisabled "Cimber Valerius"). Does this actually work or are we having us another broken script?

User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini » 15 Jul 2014, 11:29

btw. we are now at:
compiled 1188 of 1208 scripts (98.3444%)
for the 3 default content files. The missing script instructions I see are:

* ModResistParalysis
* HurtStandingActor
* GetParalysis
* GetChameleon
* GetCollidingPC

If someone is willing to help out with these, we should be able to get to 100% by 0.32.0.

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl » 15 Jul 2014, 11:32

One more issue (I vaguely remember this being mentioned before, but I can't find any references to it). The getDisabled function works either with an implicit or an explicit reference. However in the default content files I also find this function with an addition argument (e.g. GetDisabled "Cimber Valerius"). Does this actually work or are we having us another broken script?
I think it does the same as invoking disable / getdisabled without any reference. Bottom line, it's useless (unless that call has an implicit reference).

Code: Select all

disable, "fargoth"
fargoth->getdisabled
GetDisabled -> 0.00
getdisabled, "fargoth"
GetDisabled > 1.00

Code: Select all

disable
getdisabled
GetDisabled -> 1.00
enable
getdisabled
GetDisabled -> 0.00
So on our side, add a garbage string argument to the function and we should be fine.
* ModResistParalysis
* HurtStandingActor
* GetParalysis
* GetChameleon
* GetCollidingPC
I should be able to handle these.

silentthief
Posts: 361
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Scripting - Once Again

Post by silentthief » 16 Jul 2014, 07:36

scrawl wrote:
- Can the same object have multiple targeted scripts running at the same time?
No. When attempting to add more scripts, nothing happens. The original script keeps running.
Are you sure, according to MWSFD 9 Objects may have several different targeted scripts running on them at one time, and may also have a local script. if interested, check here:http://www.scribd.com/doc/7007668/Morro ... -Dummies-9

Not saying that Morrowind Scripting For Dummies was always correct, just asking.

ST
"Hurry, hurry! Last boat to Solstheim! Until the next one. Hah-ha-hah."

User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini » 16 Jul 2014, 08:35

Interesting. I was considering to allow multiple scripts per object anyway, because that is actually less work for me, more in the line of OpenMW's no arbitrary limitations philosophy and unlikely to break anything. It would still be good to double check the behaviour of vanilla MW.

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl » 16 Jul 2014, 09:31

Are you sure, according to MWSFD 9 Objects may have several different targeted scripts running on them at one time
Tried again, I stand corrected. I must have got bit by the "each script can only be attached to one object" limit the first time I tried it. Thanks!

User avatar
Zini
Posts: 5535
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini » 17 Jul 2014, 08:17

I have also seen the following syntax mentioned on the bug tracker:

x -> StopScript
x -> ScriptRunning

I guess the explicit reference would simply be ignored here?

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests