Page 1 of 5

Scripting - Once Again

Posted: 14 Jul 2014, 16:10
by Zini
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.

Re: Scripting - Once Again

Posted: 15 Jul 2014, 09:34
by Zini
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?

Re: Scripting - Once Again

Posted: 15 Jul 2014, 11:21
by scrawl
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.

Re: Scripting - Once Again

Posted: 15 Jul 2014, 11:24
by Zini
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?

Re: Scripting - Once Again

Posted: 15 Jul 2014, 11:29
by Zini
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.

Re: Scripting - Once Again

Posted: 15 Jul 2014, 11:32
by scrawl
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.

Re: Scripting - Once Again

Posted: 16 Jul 2014, 07:36
by silentthief
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

Re: Scripting - Once Again

Posted: 16 Jul 2014, 08:35
by Zini
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.

Re: Scripting - Once Again

Posted: 16 Jul 2014, 09:31
by scrawl
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!

Re: Scripting - Once Again

Posted: 17 Jul 2014, 08:17
by Zini
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?