Quick dialogue script fragment help needed!

Post » Wed Jun 20, 2012 10:05 am

I have a quest variable that's an integer. I need to set it to something different at the end of a dialogue line. I currenly have:

(GetOwningQuest().MetHenrik) = 1
But when I try to compile I get the error, "required (...)+ loop did not match anything at input '='" What exactly does this mean? I just need to set my quest variable 'MetHenrik' to 1 so I can use it as a dialogue condition.

Thanks,
AJV
User avatar
Averielle Garcia
 
Posts: 3491
Joined: Fri Aug 24, 2007 3:41 pm

Post » Wed Jun 20, 2012 12:38 pm

Bump. :(

I need to do this in like 4 different places and without it my entire quest is sunk in the water. It has to be something simple that I don't yet understand that someone can point out for me...
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Wed Jun 20, 2012 6:19 am

Scripting newbie myself, but did you declare the MetHenrik property?
User avatar
Mistress trades Melissa
 
Posts: 3464
Joined: Mon Jun 19, 2006 9:28 pm

Post » Wed Jun 20, 2012 11:56 am

Scripting newbie myself, but did you declare the MetHenrik property?
In the quest script, yes. And the dialogue is on the same quest, so (GetOwningQuest().MetHenrik) should point to that variable, but I'm guessing my syntax is off or something...
User avatar
Emily Jeffs
 
Posts: 3335
Joined: Thu Nov 02, 2006 10:27 pm

Post » Wed Jun 20, 2012 10:07 am

I would not be surprised if getting a quest variable like that gives you a read-only copy...

Can't offer more than that speculation, sorry :confused:

EDIT: If that is the case, I can think immediately of two workarounds: use a global var, or use a quest stage that specifically just sets the var to 1.
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Post » Tue Jun 19, 2012 11:36 pm

GetOwningQuest() requires a reference and you have none there.

Anyway you can also handle this in such a way instead:

add to your script fragment this code (but not in begin or end window!) and autofill it in properties window:
myQuestScriptName Property myQuestRef auto
where myQuestScriptName is the name of the script attached to your quest

then in begin and end forms of your topic fragment you can use:
myQuestRef.MetHenrik = 1
User avatar
Gracie Dugdale
 
Posts: 3397
Joined: Wed Jun 14, 2006 11:02 pm

Post » Tue Jun 19, 2012 11:34 pm

GetOwningQuest() requires a reference and you have none there.

Anyway you can also handle this in such a way instead:

add to your script fragment this code (but not in begin or end window!) and autofill it in properties window:
myQuestScriptName Property myQuestRef auto
where myQuestScriptName is the name of the script attached to your quest

then in begin and end forms of your topic fragment you can use:
myQuestRef.MetHenrik = 1
That works in full scripts, but when I get a script for my dialogue info, I can't edit the properties, or the source. So I cannot do that...

Also, I have never once given GetOwningQuest() a reference and it always works just fine. :/
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Wed Jun 20, 2012 4:37 am

That works in full scripts, but when I get a script for my dialogue info, I can't edit the properties, or the source. So I cannot do that...

Also, I have never once given GetOwningQuest() a reference and it always works just fine. :/

GetOwningQuest() is a member function of TopicInfo, you don't need to specify an object for it when using it in quest dialogue as it runs from a TopicInfo already.
Every single quest I have seen that uses GetOwningQuest() in quest dialogue uses it like this. Every quest I have seen that's made by Bethesda too.


Just for your future reference: You can set properties on code fragments in quest dialogue :) To the right of the box where you type the code there is a list that says Script Name. Highlight this script and click Properties.
User avatar
Sophie Morrell
 
Posts: 3364
Joined: Sat Aug 12, 2006 11:13 am

Post » Tue Jun 19, 2012 11:51 pm

That works in full scripts, but when I get a script for my dialogue info, I can't edit the properties, or the source. So I cannot do that...
Script fragments in Topic Info are exactly like any other scripts. It is possible to edit their code and access their properties like any other script. And the code I posted to access and change variables in quest scripts works very well. I built the whole menu system with hundreds of options on that.


GetOwningQuest() is a member function of TopicInfo, you don't need to specify an object for it when using it in quest dialogue as it runs from a TopicInfo already.
Every single quest I have seen that uses GetOwningQuest() in quest dialogue uses it like this. Every quest I have seen that's made by Bethesda too.

Object? Possibly no. Reference? Definitely yes.

you can't just type in script fragment:

(GetOwningQuest().MetHenrik) = 1

because this won't even compile


but you can type:
(GetOwningQuest() as myQuestScript).MetHerik = 1
this compiles just fine and GetOwningQuest() references here particular script assigned to certain quest
And every single script in original game that has GetOwningQuest() function uses it in such a way...
User avatar
abi
 
Posts: 3405
Joined: Sat Nov 11, 2006 7:17 am

Post » Wed Jun 20, 2012 11:06 am

GetOwningQuest() is a member function of TopicInfo, you don't need to specify an object for it when using it in quest dialogue as it runs from a TopicInfo already.
Every single quest I have seen that uses GetOwningQuest() in quest dialogue uses it like this. Every quest I have seen that's made by Bethesda too.


Just for your future reference: You can set properties on code fragments in quest dialogue :smile: To the right of the box where you type the code there is a list that says Script Name. Highlight this script and click Properties.
Script fragments in Topic Info are exactly like any other scripts. It is possible to edit their code and access their properties like any other script. And the code I posted to access and change variables in quest scripts works very well. I built the whole menu system with hundreds of options on that.
That's just it. For some reason I cannot edit this dialogue script. The 'Properties' button is grayed out. And if I right click on the script, most of the options (Including edit source) are grayed out, and if I say Edit Properties, it opens the window but all the buttons are grayed out... It also sometimes says something like 'Error when reopening script'. How can I fix this? :/
User avatar
Gemma Woods Illustration
 
Posts: 3356
Joined: Sun Jun 18, 2006 8:48 pm

Post » Wed Jun 20, 2012 2:33 am

How can I fix this? :/
I saw a topic here somewhere that mentioned this as a bug, but can't remember the details...

Anyway, I edited the post above yours with proper use of GetOwningQuest() function, try this approach and see whether it helps...



It also sometimes says something like 'Error when reopening script'. How can I fix this? :/

Try this:
1. delete everything you have in begin and end fragments entirely (even spaces should not be left)
2. select fragment's name and press remove button
3. press OK to confirm and close Topic Info window
4. reopen topic info window
5. put one semicolon in end fragment form, and press OK to close Topic Info Window
6. reopen Topic Info window and check wheter it is possible to edit fragment's source or properties... -?-
User avatar
Darian Ennels
 
Posts: 3406
Joined: Mon Aug 20, 2007 2:00 pm

Post » Wed Jun 20, 2012 3:32 am

Fragments are persnickety. IIRC, Dialog fragments can't add properties directly, but use the properties on the main fragment script in the quest (Main quest script tab, put the properties there)
User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Wed Jun 20, 2012 4:09 am

I saw a topic here somewhere that mentioned this as a bug, but can't remember the details...

Anyway, I edited the post above yours with proper use of GetOwningQuest() function, try this approach and see whether it helps...





Try this:
1. delete everything you have in begin and end fragments entirely (even spaces should not be left)
2. select fragment's name and press remove button
3. press OK to confirm and close Topic Info window
4. reopen topic info window
5. put one semicolon in end fragment form, and press OK to close Topic Info Window
6. reopen Topic Info window and check wheter it is possible to edit fragment's source or properties... -?-
I tried remaking the fragment a bunch of times.

I'm going to try adding your 'as' thing to the line to see if it works.

Changing it to (GetOwningQuest() as MyQuestScript).MetHenrik = 1 worked. I'm silly, it would be different because the script isn't directly part of the quest like a stage or objective is! Of course!

Thanks everyone!
User avatar
carley moss
 
Posts: 3331
Joined: Tue Jun 20, 2006 5:05 pm

Post » Wed Jun 20, 2012 9:38 am

Ah, I see (maybe). Typing GetOwningQuest().SetStage(10) works in a QF because quest stages (and aliases, scenes, and dialogue topics) are integral parts of um, well, quests, while Ints and other things defined by scripts are 'add-ons' that affect the integral parts. So when you change a quest stage, you are only moving from one integral part to another - quest scripts (incl QFs), however, affect the integral parts from 'outside the box', so to speak, so you have to tell the quest where to find it.

I think it comes down to quests being a type of object, with it's own defined base script, and any scripts attached to a quest act just like scripts attached to an ObjRef. New stuff has to be referenced through commands understood by the old stuff. SetStage, SetObjective and getAlias are part of the base quest object script, and so don't need definition.

Amirite? :D
User avatar
Michelle Smith
 
Posts: 3417
Joined: Wed Nov 15, 2006 2:03 am


Return to V - Skyrim