Jump to content

Print out "GetStage" value?


dubiousintent

Recommended Posts

I'm trying to trace the logic of someone else's Quest scripts. As part of that I need to know what Stage the quest is at in various sub-scripts. So far I have not had any success in getting the "GetStage" function (which returns an integer) to assign it's result to a variable so I can print it to a debug file.

 

All the examples I found use "GetStage <Quest EditorID>" as part of a conditional statement (e.g. "If GetStage VT47 == 10" ...). I've tried using NVSE functions such as "Let", "Eval", "ToString", and even a UDF, but can't make an assignment of the function return. It's looking like it's a "conditional only" function even though it's not so marked on the wikis.

 

Really hoping someone will have an answer other than "While Loop through comparing 'GetStage' with the possible range of values until it doesn't match and then use that (test value - 1)".

 

(Can't believe I couldn't find anyone asking about this previously.)

 

-Dubious-

Link to comment
Share on other sites

Ya I just recently found out "GetStage" is a bit wonky for returning results ... says wants to return highest completed.

 

But anyways ... how about just put a command in the "Result Script" field of the stage.

 

If PrintToConsole doesn't work there ... you could put an Int variable in the Quest script , then put a line like this in the stage script ... Set Myvariable to {Quest Stage} ...

Then your external debugging script ... just use "GetQuestVariable"

 

At least I think that will work for you. Is this for "aaNVB3Main03" & "aaNVB3Main04" ?

Link to comment
Share on other sites

Yes, it's for NVB3. I've traced my problem to the "aaMarkoEnterSceneBarkTriggerSCRIPT" not meeting it's conditional. Trying to trace back to where it gets called. Someguy set some quest variables in conversation "Result Script" blocks, which makes it a pain to backtrack.

 

Hadn't been aware of the "encapsulation" braces. But again it looks like it only works in a conditional, "encapsulating a function as an argument to another function"? "Set to" is old school equivalent to NVSE "Let :=", but that won't accept "GetStage <Quest EditorID>" as a parameter, so we are back to my initial problem of assigning the value to a variable, which I had also attempted. Did you actually test that encapsulation works for assignment? (I tried using parens but it failed as well.)

 

It seems "GetStage" works similar to DOS "errorlevel", which will return "true" for every value less than or equal to what it is set to. So when testing you have to work down from the max to the min. And that is apparently my answer. It doesn't actually contain a "value", singular. Instead it seems to actually be a range of values ( possibly a "bit flag"). So it will only work in a "conditional". (Looks like I will have use the "While Loop" construct in a UDF after all.) After some testing to confirm, I'll suggest the "Community GECK Wiki" flag it that way.

 

Thanks for the response. It did help my thinking. (Sometimes the squirrel gets stuck in the wheel.) :confused:

 

-Dubious-

Link to comment
Share on other sites

You said : "Hadn't been aware of the "encapsulation" braces."

 

You mean when I wrote "Set Myvariable to {Quest Stage} ..." ?

 

Oh no no ... I'm not saying to use those ... I am saying to use the quest stage #

 

So on quest stage 15 in "Result script" field Put "Set MyVariable to 15"

 

But in this script "aaNVB3Main03QuestSCRIPT" you declared your Int variable

 

That is if PrintToConslole doesn't work ... as I'm not familiar with using that.

Edited by Mktavish
Link to comment
Share on other sites

But then again , since you have to name the quest to set the variable. Might as well use your own external Quest script to declare the variable , and have it tell you what its local variable is that is telling you what aaNVB3Main03 quest stage is at presently.

 

I think the problem with getstage and getstagedone ... is that they are wanting to return what is completed ... and it seems for your purposes ... you want to know what stage is active , which looks like there isn't a way to check that with a function.

Where I am assuming the result script of the stage will output the info you want instead.

 

What I had to do with my recent mod ... was ask what objective was presently showing.

 

GetObjectiveDisplayed

Edited by Mktavish
Link to comment
Share on other sites

If it's really only a matter of checking out a mod's quest stages, try some console commands like ShowQuestStages. I believe they may also show when using ShowQuestVars.

 

(Edit: I once used GetStage extensively in a quest mod, so I'd be surprised if it didn't return anything, although it is true it returns the highest completed stage, which can be problematic with quests where stages are repeatable and set to earlier stages. Consider the possiblity that you're doing the printout wrong.)

Edited by DoctaSax
Link to comment
Share on other sites

If it's really only a matter of checking out a mod's quest stages, try some console commands like ShowQuestStages. I believe they may also show when using ShowQuestVars.

 

(Edit: I once used GetStage extensively in a quest mod, so I'd be surprised if it didn't return anything, although it is true it returns the highest completed stage, which can be problematic with quests where stages are repeatable and set to earlier stages. Consider the possiblity that you're doing the printout wrong.)

Unfortunately, the part of the quest ("aaNVB3Main03" in Someguy's "New Vegas Bounties III": see thread "Force a change of scene?") I'm trying to debug has the player controls completely disabled and is hanging during a "FadeInfromBlack" and the trigger of another script. I've found where the player controls are disabled and may have to work around that by leaving them enabled if necessary, but I'm fixated for the moment on getting all the elements of my debug output to file in order to trace the flow from script to script at the moment. For that I really need the trail a log file provides.

 

I have been assuming I am doing something wrong with the "DBPrintC" command, but it is only the attempt to get the value of "GetStage" output. (I've done decades of scripting in other languages; it's just this is really my first foray into GECK functions and syntax so I'm experiencing the early learning curve.) Here is just one example I've tried:

DBPrintC "Failed [aaKillRoomExitTriggerSCRIPT], 'aaNVB3Main03.CaptorBark' = [%g], 'DoOnce' = [%g], QStage [" + $(GetStage aaNVB3Main03) + "].", aaNVB3Main03.CaptorBark, DoOnce

The output stops at ", QStage [" with the other values filled in, so I'm concluding the "ToString" isn't working. Other attempts to directly assign the result of "GetStage" to a variable (e.g. "Let iQStage := GetStage aaNVB3Main03", with and without parens around the right side) have failed indicating the "GetStage aaNVB3Main03" function or it's parameter is not suitable/recognized/valid. Same with simply having it passed into a "%g/z" formatting string.

 

The "ShowQuestVars" is sort of overkill, but can I use it in a script? (it's in the Category: Console Functions, which makes me wonder.)

 

@Mktavish: "GetObjectiveDisplayed" requires knowing the objective index. When script logic is failing, it's usually because things are not as expected. So, first step is to determine what they actually are at that point.

 

Thanks for your help.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

You're mismatching acceptable syntax for the different print functions.

DBPrintC (aka DebugPrint) is like printc (PrintToConsole), in that it only accepts a string, with optional format specifiers, such as: "my string: %g" iSomeNumber

You cannot concat with it.

 

In order to print out concatted strings, string-returning functions, or ToString'ed forms and numbers, you use Print, PrintD (PrintDebug) etc.

 

So it's either:

set iStage to GetStage aaNVB3Main03

DBPrintC "Failed blah blah %g, doonce %g, qstage %g" aaNVB3Main03.CaptorBark, DoOnce, iStage

 

or

PrintD "Failed blah blah bark = " + $(aaNVB3Main03.CaptorBark) + ", 'DoOnce' = [" + $DoOnce + "], QStage [" + $(GetStage etc- + "']."

 

I notice the "getting started" article has it wrong too, might wanna change that.

Edited by DoctaSax
Link to comment
Share on other sites

Ya I just mentioned the "GetObjectiveDisplayed" is what I ended up using in making that dumpster work in this thread

https://forums.nexusmods.com/index.php?/topic/5884328-need-help-with-a-script/page-2

Post #20 1st and 3rd script.

 

I had tried using Getstage & GetstageDone ... in those places ... but those conditionals would not advance the script , when I knew it was suppose to be on the correct stage. So IDK what up with those.

 

Wasn't suggesting for you to use GetObjectiveDisplayed ... would be to much extracurricular work for your purposes.

 

Have you tried just putting something like this line in each of the Quest stage "Result Scripts"

 

"PrintC aaNVB3Main03 Stage # ; put the relative stage number at end of string.

 

Looks like there is only 5 of those NVB3 Quests have stages ... although 3 have quite a few stages ... just a bit of copy paste , then change the stage #

Link to comment
Share on other sites

  • Recently Browsing   0 members

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