Scripting - Once Again

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

Re: Scripting - Once Again

Post by Zini »

The targeted script implementation can now be found in my scripts branch. Hopefully. I had to make some invasive changes to the VM (among other things) and it is possible that I broke stuff. Extensive testing (not only of targeted scripts) required.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl »

startScript with an implicit reference from a local script is not working. I think you are missing a targetId argument here. It's probably also a good idea to remove the default argument to prevent similar issues elsewhere in the code.

Edit: We need the same fix for the InterpreterContext in dialogue scripts. There is also a startScript "karrodMovement" in a dialogue response by King Hlaalu Helseth.

Code: Select all

diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp
index f8b4c98..2f965fe 100644
--- a/apps/openmw/engine.cpp
+++ b/apps/openmw/engine.cpp
@@ -57,7 +57,7 @@ void OMW::Engine::executeLocalScripts()
         std::pair<std::string, MWWorld::Ptr> script = localScripts.getNext();
 
         MWScript::InterpreterContext interpreterContext (
-            &script.second.getRefData().getLocals(), script.second);
+            &script.second.getRefData().getLocals(), script.second, script.second.getCellRef().getRefId());
         MWBase::Environment::get().getScriptManager()->run (script.first, interpreterContext);
     }
 
diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
index 5d55a7a..20aa9ac 100644
--- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
+++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
@@ -259,7 +259,7 @@ namespace MWDialogue
         {
             try
             {
-                MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
+                MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor,mActor.getCellRef().getRefId());
                 Interpreter::Interpreter interpreter;
                 MWScript::installOpcodes (interpreter);
                 interpreter.run (&code[0], code.size(), interpreterContext);
These changes make Helseth's Champion quest work properly, but there are probably more InterpreterContext that I've missed. Removing the default argument should reveal them all.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini »

Thanks. I'll look into it.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl »

Since we are on the topic of global scripts, can you please make a decision on 1461? Apparently in vanilla MW, stopped start scripts will re-start whenever a save is loaded. This allows for a save reload detector, just like the object re-scaling.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini »

No point in deriving from the original behavior, since it basically doesn't cost us anything. This is trivial change and we can offer a new GMST later to switch to a more sensible behavior.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini »

Begin Museum RobeLich

if ("Torasa Aram".maceslurring < 2)
Disable
endif

if ("Torasa Aram". == 2)
Enable
endif

if (OnActivate == 1)
player->additem "robe_lich_unique" 1
PlaySound "Item Clothes Up"
Disable
set "Torasa Aram".robelich to 3
endif

End MuseumRobeLich
error line 6, column 21 (==)
Unexpected special token
compiling failed: museum
Fuck you, Morrowind.esm. I have no idea what to do with this. Anyone got any input?
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Scripting - Once Again

Post by scrawl »

I vaguely recall this script name. As it turns out from an earlier thread:
Museum (Museum RobeLich) isn't used, there's a MuseumRobeLich that is.

Code: Select all

 ./esmtool dump /home/scrawl/mwdata/Tribunal.esm | grep -i "Script: Museum"
  Script: MuseumScript
  Script: MuseumEleidonsward
  Script: MuseumLordsMail
  Script: MuseumSaviorsHide
  Script: MuseumBootsTenPace
  Script: MuseumEbonyMail
  Script: MuseumBootsApostle
  Script: MuseumAurielShield
  Script: MuseumBootsBlinding
  Script: MuseumBitterMercy
  Script: MuseumUmbraSword
  Script: MuseumDaggerFang
  Script: MuseumAurielBow
  Script: MuseumVelothJudgment
  Script: MuseumMaceMolagBal
  Script: MuseumBowShadows
  Script: MuseumDragonBone
  Script: MuseumGoldbrand
  Script: MuseumHelmBearclaw
  Script: MuseumIceblade
  Script: MuseumChrysamere
  Script: MuseumSkullCrusher
  Script: MuseumSpellBreaker
  Script: MuseumStaffMagnus
  Script: MuseumStaffHasedoki
  Script: MuseumRingPhynaster
  Script: MuseumRingWarlock
  Script: MuseumRingVampiric
  Script: MuseumHelmBloodworm
  Script: MuseumBiPolarBlade
  Script: MuseumMaceSlurring
  Script: MuseumStendarHammer
  Script: MuseumRobeLich
  Script: MuseumDagSym
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Scripting - Once Again

Post by silentthief »

Not exactly sure if related to the last question of how morrowind esm does things, but there were a few script commands, and a few scripts themselves, which were not used because the team at bethesda didn't finish them out or whatever. Here is a list of the scripts which includes a mention if they were broken or didn't work as expected:

http://www.uesp.net/morrow/editor/mw_cscommands.shtml

ST
[edited for clarity]
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini »

Guess we have to think about a script blacklisting feature. We need that for OpenCS anyway.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting - Once Again

Post by Zini »

Do we know if mockchangescript is one of these unused scripts? I would love to add it to the blacklist.

Edit: also doortestwarp and ColonySeler. Anyone any input on these?
Post Reply