Jump to content

Script help needed


ReverendFelix

Recommended Posts

What's wrong with these scripts? They are from "Tales from Elsweyr Anequina. I am redoing the EDID's, but The CSE won't let me recompile them. I am trying to change all "001" instances to "rev". I used TES4edit to get all but these done. It seems to have a character limit, so no go. Now trying to do it in the CSE to no avail.

 

P.S. Notepad was a bad idea...

 

Script 1

 

Scriptname 001WatchTowerScript

 

; Applied to Black Book

 

short message

short triggered

ref target

 

Begin OnActivate

 

if ( getDistance player < 160 ) && ( triggered == 0 )

playgroup forward 1

MessageBox " This old book tells of a watchtower due west, where 1000 years ago savage ogres massacred a group of Akavari warriors"

set triggered to 1

endif

 

End

 

Script 2

 

scn 001OldWatchTowerMap

 

short message

 

Begin OnActivate

ShowMap OldWatchTowerMapMarker

if message == 0

MessageBox "Interesting. I wonder if I can find any clues in the Old Watch Tower as to the whereabouts of this Great Obsidian Armor and the Obsidian Weapons."

set message to 1

SetStage 001ZealousInspector 5

AddTopic 001Privacy

endif

Activate

End

 

Script 3

 

ScriptName 001DeepCavesMap

 

short message

 

Begin OnActivate

ShowMap DeepCavesMapMarker

if message == 0

MessageBox " Hmm. If I want to go into the Deep Caves in search of this armor and these weapons, I better go prepared. It is probably full of ogres and I doubt they are going to let me just look around..."

set message to 1

endif

Activate

End

Edited by ReverendFelix
Link to comment
Share on other sites

EditorIDs should never start with a number. Then it's always unpredictable which ones will be allowed and which ones deemed invalid.

When its notation starts with a number, then compiler is expecting a hexadecimal FormID, not a human-readable EditorID.

 

Now, you didn't tell the exact error you get, but I'd bet my monthly wages (if I were into betting) that it's related to that.

Link to comment
Share on other sites

To DrakeTheDragon;

 

Exactly why I am doing the EDID redo. That and no one else ever did. For the love of cats! For the error, it says the short message is reserved for a script command. I can't even save a compile the original script. Let alone after changing the instances of 001 to rev.

 

To Oblivionaddicted;

 

I am redoing ALL of the EDID's from the mod. Mostly done, save these stubborn scripts. You think I should maybe release a beta? It will surely break game saves at this point, due to mismatched EDID's.

 

Thanks to you both for responding btw...

Edited by ReverendFelix
Link to comment
Share on other sites

"message" is a short. Why not simply make it "sMessage" instead?

Script 1
 
Scriptname 001WatchTowerScript
 
; Applied to Black Book
 
short sMessage
short triggered
ref target
 
Begin OnActivate
 
    if ( getDistance player < 160 ) && ( triggered == 0 )
        playgroup forward 1
        MessageBox " This old book tells of a watchtower due west, where 1000 years ago savage ogres massacred a group of Akavari warriors"
        set triggered to 1
    endif 
 
End
 
Script 2
 
scn 001OldWatchTowerMap
 
short sMessage
 
Begin OnActivate
    ShowMap OldWatchTowerMapMarker
    if sMessage == 0
        MessageBox "Interesting. I wonder if I can find any clues in the Old Watch Tower as to the whereabouts of this Great Obsidian Armor and the Obsidian Weapons."
        set sMessage to 1
        SetStage 001ZealousInspector 5
        AddTopic 001Privacy
    endif
    Activate
End
 
Script 3
 
scn 001OldWatchTowerMap
 
short sMessage
 
Begin OnActivate
    ShowMap OldWatchTowerMapMarker
    if sMessage == 0
        MessageBox "Interesting. I wonder if I can find any clues in the Old Watch Tower as to the whereabouts of this Great Obsidian Armor and the Obsidian Weapons."
        set sMessage to 1
        SetStage 001ZealousInspector 5
        AddTopic 001Privacy
    endif
    Activate
End 

(Hope I got them all.)

 

But of course, by all means, change those "001..." names as well like you set out to.

Link to comment
Share on other sites

Ok, first I updated script 3 in the OP after realizing it was the same as script 2. Second I got the exact info regarding errors for script 3. It seems the simplest, so working it out first.

 

Save and compile-resulting error with no edits to the script;

 

line 3-The identifier message is reserved for a script command.

 

Save and compile-resulting error with your suggested smessage edit;

 

line 3-Variable smessage unreferenced in local context.

 

line 7-Invalid condition expression.

 

line 7-No message text.

 

Now, while I don't have much understanding yet regarding tes script syntax, I have scripted in other games. I get the basic flow of how they work. To me this script seems flawed in the way the identifier is being interupted by the showmap on line 6. Just a guess here. I'm thinking a revision may be in order. Any ideas on a rewrite that would work?

Link to comment
Share on other sites

Alright...

If I got that right, your Script 3 should then be:

ScriptName 001DeepCavesMap
 
short sMessage
 
Begin OnActivate
    ShowMap DeepCavesMapMarker
    if sMessage == 0
        MessageBox " Hmm. If I want to go into the Deep Caves in search of this armor and these weapons, I better go prepared. It is probably full of ogres and I doubt they are going to let me just look around..."
        set sMessage to 1
    endif
    Activate
End 

Then...

- The 1st error, which is actually only a warning and could just as well simply be ignored, only tells you that there's a declaration for a variable "sMessage" at the top of Script 1, but "sMessage" is then never used inside the script.

You can either ignore this, like I said, or simply remove the line "short sMessage" from Script 1, if it bothers you too much.

 

- The 2nd error is a little bit more tricky, but it will soon become second nature to you, too. ObScript doesn't like anything else than parameters written behind function calls. So the line "if ( getDistance player < 160 ) && ( triggered == 0 )" doesn't compile, because of the part "getDistance player < 160".

You can either rewrite it like so: "if ( 160 > getDistance player ) && ( triggered == 0 )" or like so: "if ( ( getDistance player ) < 160 ) && ( triggered == 0 )". Putting the function call with parameters into brackets usually isolates it from the rest of the line.

You can also just leave away the brackets around your partial conditions, as it's not needed in this language: "if ( getDistance player ) < 160 && triggered == 0" The brackets around the function call must remain though, even with my first rewrite "160 > (...)" in that case, or the "&&" will cause the next fuss.

 

- The 3rd error doesn't make any sense to me though, especially as there isn't even a "Message" or "MessageBox" in line 7 at all. But lines will become confused, too, when the compiler runs into an error before. So maybe it'll go away the same moment you fix #2. It could, however, also be very possible, due to Oblivion being notorious for weird nonsensical behavior, that you must not start message texts with a blank like 2 of your's do.

 

 

I don't understand what you mean by "the identifier is being interrupted by the ShowMap on line 6" though. This line in particular looks absolutely fine.

 

 

edit: Had to retype the whole text again, as the editor always removes everything behind the code blocks on submit. cO (Memorize this finally, silly dragon!)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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