Papyrus Property Manager Does Not Define Variables?

Post » Tue Jun 19, 2012 6:42 am

Hey all,

I asked this question on the steam forums, but after some research I figured this was a better place to ask this question. I'll start from the beginning.

I've been having SERIOUS trouble with papyrus and scripting. I was pretty comfortable with the old scripting in Oblivion and Fallout 3, and I've read all the wikis on the topics. But I'm still getting errors. Also note that this is occurs EVERY TIME I try to access ANY property defined in the property manager. Here's an example.

I set out to complete a simple mission: to set an objective displayed. Easy, right? I read up on how to do this on the wiki and with regard to properties, so I tried it out. In the property manager, I create a property in a quest script called ArtnMS01a, which is the name of its owning quest (I know, cryptic text. Don't ask). This is a quest property, so in the source it reads:

 Quest Property ArtnMS01a  Auto

This compiles with no errors.
Now I go to the objectives tab and make some objectives, including objective #1. I go to the stages tab and make stage 10, then put in the script fragment:

ArtnMS01a.setobjectivedisplayed(1)

When I tried this, I got this error:

Starting 1 compile threads for 1 files...Compiling "QF_ArtnMS01a_01000D96"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ArtnMS01a_01000D96.psc(18,0): variable ArtnMS01a is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ArtnMS01a_01000D96.psc(18,10): none is not a known user-defined typeNo output generated for QF_ArtnMS01a_01000D96, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on QF_ArtnMS01a_01000D96

I read this and come to some conclusions. I know that it can't find the property value for ArtnMS01, so I don't know why it can't find the value. I try this again, except with kymquest selected to the original script. I figured that would solve the problem, but yet again, it came up with the same error. :bonk:

At this point I can accept that I'm doing something wrong, or at least skipping an obvious step. Every time I try to reference a property ANYWHERE, even inside of a script that has the property defined inside of it, I get this error. So basically, I can't really do any quest scripting at all until I figure this out.

Thanks in advance for any help. It's likely I'm missing an obvious step, so I apologize for that too.
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Tue Jun 19, 2012 1:03 am

Its usually good to display more of your script than a few pieces of it.
I see no scriptname and no event block.

Also, I think the object number is the stage number. So it would be a 10, not a 1. Worth a try at least.
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Tue Jun 19, 2012 3:10 am

ArtnMS01a is just your property name. Properties are set in the property manager, not within the script. This is why the error log is telling you it's undefined.
Go back to your script and this time click on Properties, you'll get a new window and you can change property values/variables there.

using debug.trace("text here") for example, after your lines of code will override "successful" compiles if there is an error.

http://www.creationkit.com/Notification_-_Debug
http://www.creationkit.com/Trace_-_Debug
http://www.creationkit.com/TraceUser_-_Debug
http://www.creationkit.com/TraceStack_-_Debug

I'll also stress, do post your entire script.
User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm

Post » Tue Jun 19, 2012 10:36 am

Its usually good to display more of your script than a few pieces of it.
I see no scriptname and no event block.

The reason I didn't post the rest of the script is because I figured it was implied, sorry. It is there.

Scriptname ArtnMS01QuestScript extends Quest  Quest Property ArtnMS01a  Auto  

I haven't yet added any functions or anything quite yet.

ArtnMS01a is just your property name. Properties are set in the property manager, not within the script. This is why the error log is telling you it's undefined.
Go back to your script and this time click on Properties, you'll get a new window and you can change property values/variables there.

I did use the property manager- I just copied over the source text. This is basically what the property manager put into the script when I made the property.
User avatar
Aaron Clark
 
Posts: 3439
Joined: Fri Oct 26, 2007 2:23 pm

Post » Tue Jun 19, 2012 11:06 am

The reason I didn't post the rest of the script is because I figured it was implied, sorry. It is there.

Scriptname ArtnMS01QuestScript extends Quest  Quest Property ArtnMS01a  Auto  

I haven't yet added any functions or anything quite yet.



I did use the property manager- I just copied over the source text. This is basically what the property manager put into the script when I made the property.

Besides using the property manager, did you actually assign a value to the property?

Another thing, the error text call your property 'variable', maybe you are using a property and a variable you placed in your code before? Also, the errors are about the line 18, but if you didn't place all your script in one piece we can't know which one is the 18 line.
User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Tue Jun 19, 2012 7:35 am

That's where it starts getting baffling. There is no line 18. There are only two lines.
And yes, I assigned the property and everything.

EDIT --- I figured out the line 18 issue. We're looking at THIS script, the one including the fragment. My bad.

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 4Scriptname QF_ArtnMS01a_01000D96 Extends Quest Hidden;BEGIN ALIAS PROPERTY BookInSearch;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_BookInSearch Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY JamieAlias;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_JamieAlias Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN AUTOCAST TYPE ArtnMS01QuestScriptQuest __temp = self as QuestArtnMS01QuestScript kmyQuest = __temp as ArtnMS01QuestScript;END AUTOCAST;BEGIN CODEArtnMS01a.setobjectivedisplayed(1);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin comment
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Tue Jun 19, 2012 4:20 pm

My guess is you can't name an object with the first letter being an underscore. Everything should begin with a 'alphabetic' character. Not a number either unless they fixed that bug from previous games.
User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm

Post » Tue Jun 19, 2012 5:36 am

What object are you reffering to? I'm not using any objects or properties with underscores...
The only one I see on the script is _temp. Any idea what that's there for?
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Tue Jun 19, 2012 3:48 am

Line 18 contains the __temp quest name.
I don't know why its there.
User avatar
Roy Harris
 
Posts: 3463
Joined: Tue Sep 11, 2007 8:58 pm

Post » Tue Jun 19, 2012 2:48 pm

I replaced _Temp with the quest ID, which compiled but did not change the result...
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am

Post » Tue Jun 19, 2012 9:09 am

These fragments are a PITA, as the CK writes a lot of the stuff for you. So as you know the syntax for declaring a property, it is invalid to do so in the fragment. As you can see from the autogenerated script all your input that you write into the fragment, the code resides within a function - so Property declaraions cause errors.

If you want to add Properties, then you need to use the Property button, and then Add them there. You can see that the CK will automatically add some Quest Alias properties for you (whether you wanted them or not).
But, that means that you first need a valid script.

1. Save a simple script fragment with some dummy valid code. 'int foo'
2. Add your properties to the script with the Properties dialog.
3. Re-edit your script using the newly declared properties.

Note: Sometimes the Add button is greyed out. Appending your property line after ALL the autogenerated lines should work - as that's where the CK puts it.
So you'd need to click the advanced tab to get the scriptname, then use an external editor.


Edit: That __temp is fine. Your looking at the autogenerated code that provides you with the magic variable kmyQuest
As the file says... it's best not to edit between the lines.
User avatar
Lalla Vu
 
Posts: 3411
Joined: Wed Jul 19, 2006 9:40 am

Post » Tue Jun 19, 2012 1:35 pm

Not really sure where people are getting this, I've been using the property manager. My issue is that either, I'm doing something else wrong, or the property manager is not validating the properties.

1. Save a simple script fragment with some dummy valid code. 'int foo'

This is the only thing that I'm unsure that I did. So I basically need to fill the script with some random info first? Is that necessary?

Edit: I think I get what you're saying- so I need to add the properties to this QF script, not the script I made?
User avatar
Lalla Vu
 
Posts: 3411
Joined: Wed Jul 19, 2006 9:40 am

Post » Tue Jun 19, 2012 3:42 pm

Okay, so I'm pretty sure I solved this scenario. My problem was that I was putting properties on a script that was separate from the fragments, so the script couldn't track the properties. I think.

That is, I got it to compile alright. Now I have to test it, which I'm not too worried about. Thank you all!
User avatar
Josh Lozier
 
Posts: 3490
Joined: Tue Nov 27, 2007 5:20 pm

Post » Tue Jun 19, 2012 2:39 am

Yep, you got it :)

You can't use a custom property in a fragment until it is declared...
and you can't declare a custom property until you have a fragment script.
Hence the dummy fragment code is just to create the fragment file.

BTW, the magic variables and the script which each type of fragment extends can be found http://www.creationkit.com/Fragments]here[/url].
User avatar
D LOpez
 
Posts: 3434
Joined: Sat Aug 25, 2007 12:30 pm

Post » Tue Jun 19, 2012 7:08 am

Sorry to bother you guys again, but I might need more help with a similar situation...
This is now my attempt of a script attached to a quest alias (which happens to be a cooking pot). A bit more complex than the one above. This is meant to be that it would make the quest stage 175, but only if it's already stage 20. (Before it causes confusion, this is no longer ArtnMS01, we're looking at the quest ArtnSQ01. The property is set to the correct quest, don't worry.)
Here's my entire script:
Scriptname ArtnSQ01CookingPotSCRIPT extends ReferenceAliasQuest Property ArtnSQ01  Auto int stage = ArtnSQ01.getcurrentstageID()Event OnActivate(ObjectReference akActionRef)    if stage = 20        ArtnSQ01.setstage(175)    endifEndEvent

This is my error message:

Starting 1 compile threads for 1 files...Compiling "ArtnSQ01CookingPotSCRIPT"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,12): no viable alternative at input 'ArtnSQ01'c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,20): required (...)+ loop did not match anything at input '.'c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,4): Unknown user flag ArtnSQ01c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(7,4): no viable alternative at input 'stage'No output generated for ArtnSQ01CookingPotSCRIPT, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on ArtnSQ01CookingPotSCRIPT

Once again, the script seems unable to read my property. But this time, it's in the same script. What's up with this?
User avatar
Alexxxxxx
 
Posts: 3417
Joined: Mon Jul 31, 2006 10:55 am

Post » Tue Jun 19, 2012 6:55 am

Move the 'int stage' declaration as the first line of your Event.
You can only apply constants to properties and variables outside of events/functions.
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Tue Jun 19, 2012 4:26 am

I thing that "int stage = ArtnSQ01.getcurrentstageID()" must be in the event

Scriptname ArtnSQ01CookingPotSCRIPT extends ReferenceAliasQuest Property ArtnSQ01  Auto Event OnActivate(ObjectReference akActionRef)    int stage = ArtnSQ01.getcurrentstageID()    if stage = 20        ArtnSQ01.setstage(175)    endifEndEvent
User avatar
Umpyre Records
 
Posts: 3436
Joined: Tue Nov 13, 2007 4:19 pm

Post » Tue Jun 19, 2012 1:34 am

Sorry to bother you guys again, but I might need more help with a similar situation...
This is now my attempt of a script attached to a quest alias (which happens to be a cooking pot). A bit more complex than the one above. This is meant to be that it would make the quest stage 175, but only if it's already stage 20. (Before it causes confusion, this is no longer ArtnMS01, we're looking at the quest ArtnSQ01. The property is set to the correct quest, don't worry.)
Here's my entire script:
Scriptname ArtnSQ01CookingPotSCRIPT extends ReferenceAliasQuest Property ArtnSQ01  Autoint stage = ArtnSQ01.getcurrentstageID()Event OnActivate(ObjectReference akActionRef)	if stage = 20		ArtnSQ01.setstage(175)	endifEndEvent

This is my error message:

Starting 1 compile threads for 1 files...Compiling "ArtnSQ01CookingPotSCRIPT"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,12): no viable alternative at input 'ArtnSQ01'c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,20): required (...)+ loop did not match anything at input '.'c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(4,4): Unknown user flag ArtnSQ01c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ArtnSQ01CookingPotSCRIPT.psc(7,4): no viable alternative at input 'stage'No output generated for ArtnSQ01CookingPotSCRIPT, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on ArtnSQ01CookingPotSCRIPT

Once again, the script seems unable to read my property. But this time, it's in the same script. What's up with this?
ArtnS001 is a variable or a property of the type quest, to which you had assigned a value, either in the property manager or with an asignation like:
quest ArtnS001 = name_of_the_quest or is the name of the quest you are using? if it's the second you are doing wrong.

EDIT: oops! Forget what I writed. I didn't saw the declaration. :blush:
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Tue Jun 19, 2012 3:27 pm

---trials of posting fails, re-posting now....----
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Tue Jun 19, 2012 3:30 am

Thanks, but it still didn't work...
I know this is wrong (and it gives me errors too) but I know where the problem is...
I tried your fix, Planteur, but it gave me the no viable alternative error. So I tried this altered version:

Scriptname ArtnSQ01CookingPotSCRIPT extends ReferenceAliasQuestProperty ArtnSQ01 Autoint stageEvent OnActivate(ObjectReference akActionRef)        stage = ArtnSQ01.getcurrentstageID()    if stage = 20        ArtnSQ01.setstage(175)    endifEndEvent

This gave me the same result. So what is the real function for setting an integer to a value such as "ArtnSQ01.getcurrentstageID()"?***More sorries, I have no idea what's going on with my posts.

(Sorry about that posting drama, I have no idea what just happened.)
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue Jun 19, 2012 5:42 am

well, why did you remove the quest type for the property ?

edit : it's on the preceding line... If you try to compile that, errors are normal.
User avatar
keri seymour
 
Posts: 3361
Joined: Thu Oct 19, 2006 4:09 am

Post » Tue Jun 19, 2012 7:53 am

There was another very common mistake in your orig script.
The if statement should be a condition, not an assignment. (ie. use '==' and not '=')
User avatar
Melanie
 
Posts: 3448
Joined: Tue Dec 26, 2006 4:54 pm

Post » Tue Jun 19, 2012 6:40 am

And remove the "int stage" between property and Event lines
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Tue Jun 19, 2012 3:34 am

Aha! Tunisafish, nice catch! (No pun intended).
I guess all that jumbo, aside from the integer being in the wrong place, was caused by that pesky little = sign. Thanks, it compiled!And planteur, I think the int stage is necessary because otherwise it wouldn't know where to put the value. At least, I think so. It might be a useless add-on to the script...

User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Post » Tue Jun 19, 2012 6:12 am

Yeah those are hard to spot sometimes. I was wondering why Planteur's code snippet failed too.
It's a common mistake and many compilers will give you a better warning when they spot it.

BTW, I would also declare the int inside the Event as Planteur did, as that's the only place it's used so it doesn't need global script scope.
That's good programming habit. It will still work declared at the top though.
User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am


Return to V - Skyrim