Jump to content

Stymied by Script


DanTheManForth

Recommended Posts

Hello all! I am relatively new to the whole modding thing, so I apologize at first if I am asking a stupid question. The issue I am facing is that there is a section of script which tries and fails to load a file, but only sometimes. I have created a kind of "patch" esm that is a copy of the original, but with the addition of an alternate file to load in the event that the first does not work ... but I have no idea how to script it at all! Here is the bare bones script as it is now, with the troublesome file replaced with [PRIMARY OBJECT FILE] and such.

 

====================================================

 

if [GAME SETTING] == 2 || get[FILE PATH]

if [QUEST CIRCUMSTANCE]

if [OLD OBJECT FILE]

unequipItem [OLD OBJECT FILE] 0 1

endif

else

addItem [PRIMARY OBJECT FILE] 1 1

equipItem [PRIMARY OBJECT FILE] 0 1

endif

elseif [GAME SETTING] == 0

addItem [PRIMARY OBJECT FILE] 1 1

equipItem [PRIMARY OBJECT FILE] 0 1

elseif [GAME SETTING] == 1

addItem [PRIMARY OBJECT FILE] 1 1

equipItem [PRIMARY OBJECT FILE] 0 1

endif

endif

===================================================

 

What I want to do is amend the script in such a way that, if the [PRIMARY OBJECT FILE] doesn't load right away, it will immediately switch to an [ALTERNATE OBJECT FILE] to load instead. Am I making any kind of sense at all?

Link to comment
Share on other sites

Uhm. Can't quite think about this just now. No, you don't really make sense but that may just be because I'm over tired. I'm guessing you're using squarebrack-caps in place of actual formids? And you have two different mods that you want to check against?

 

Also, you can use

 tags to block your scripts - they preserve spacing and make them much easier for biological computers to parse.

 

Edit: Reading comprehension for the fail. I think I completely misunderstood you here. Well, I'll read it again in the morning.

Edited by Xaranth
Link to comment
Share on other sites

Reviewing this again after a cup of coffee, I think I understand what you're asking, but I'm a little confused. Are you talking about loading a mesh/texture that's failing? But only sometimes?
Link to comment
Share on other sites

Sorry for being so confusing; I wasn't sure how to properly "redact" my file names, and I didn't realize that the formatting would disappear by copying and pasting. I've attached a text-edit file with all the right staging. Yes. The code is supposed to equip a custom mesh/texture; sometimes it works, and sometimes it doesn't and I can't figure out what is making it so intermittent. I think it is because the mesh it is supposed to be replacing isn't compatible with the new one, so I made up a new mesh that will be compatible with the old one, but I don't know how to tell the script to try the new mesh if the old one doesn't work.
Link to comment
Share on other sites

I honestly don't think you can do that via script. The only way I can think of would be to check the model of the object currently loaded - if it's broken it would be the exclamation point - and that doesn't seem to be possible - although it might be with a plugin. If your new mesh is fully functional, you might consider just completely overwriting the old one (Either in the data files or just use your plugin to point all references to the half-working one with the fully working one).

 

Otherwise, I think the only solution here is to figure out why it's breaking (Not what you wanted to hear, I know) and fix the root cause.

Link to comment
Share on other sites

Hi DanTheManForth,

 

It's not very clear to me what, exactly, you're trying to accomplish here. Could you please provide more details?

 

there is a section of script which tries and fails to load a file, but only sometimes

Fails how? What happens/doesn't happen?

It would be very helpful if you could attach the problematic script exactly as you wrote it in the GECK.

As Xaranth suggested, you can get the script to be displayed here properly by using the 'Insert code snippet' button.

Edited by jazzisparis
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...