Modding help: how to make a boolean logic in a script..

3 posts / 0 new
Last post
vaelta's picture
vaelta
Joined:
2023-12-22 11:05
Last seen:
7 months 1 week ago

Hello. More very basic modding assistance needed!

This should, in a sensible scripting language, be utterly trivial. But this is Morrowind, so it doesn't seem like it is:

if ( GetJournalIndex "vaba10_mine" >= 10 )
    if ( GetJournalIndex "vaba10_mine" < 40 )
        enable
    endif
else
    disable
endif

 

So obviously, all I want to happen is that the NPC with the script is enabled when the journal is at those points, and otherwise disabled. I get that my "disable" is in the wrong place, logically, but if I try writing something that makes logical sense (to me) Morrowind tells me that it's invalid.

Any help much appreciated on this stupidly trivial question!

FlinSunset's picture
FlinSunset
Senior DeveloperQuest Reviewer
Joined:
2022-10-05 00:13
Last seen:
3 hours 26 min ago

if ( GetJournalIndex "vaba10_mine" < 10 )
    if ( GetDisabled == 0 )
        disable
    endif
elseif ( GetJournalIndex "vaba10_mine" >= 40 )
    if ( GetDisabled == 0 )
        disable
    endif
elseif ( GetDisabled )
    enable
endif

Your version doesn't work because it enters the >= 10 branch and completely ignores the final "else". Also, disabling/enabling object at each frame is heavy for performance, so you need to wrap them into GetDisabled checks.

vaelta's picture
vaelta
Joined:
2023-12-22 11:05
Last seen:
7 months 1 week ago

Brilliant. Thank you. Didn't know about "getdisabled"'s usage.