Changing global thru Dialogue fragment by casting

Post » Wed Jun 20, 2012 10:06 am

Long story short, I set up a simple script whose sole function is to reference two (newly made by me) global variables. I need to access those variables and change them through dialogue options. I can read the variables through conditions directly (GetGlobalVariable), but I am having trouble figuring out how to change them.

The script for the globals (mostly comments!):
Spoiler
Scriptname LGBM01Script extends Quest{Mainly holds variables}GlobalVariable Property TourDone Auto{Governs Dialogue and Enable Parents B}; sets to 1 when player starts tour; sets to 2 if tour is past first stage; sets to 3 if tour has been completed once; sets to 4 if tour completed twice (may not be used)GlobalVariable Property TourProgress Auto{Conditions tour stages}; tracks progress through scene stages; so interrupted tours resume correctly; and repeated tours keep track

Okay, so I can get the dialogue fragment to find the LGBM01Script by using
LGBM01Script property TourDone Auto
At least, I think it's finding it, because that's all that compiles. Here's what I am trying:
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 1Scriptname LGBM_TIF__0200B09F Extends TopicInfo Hidden;END FRAGMENT CODE - Do not edit anything between this and the begin commentLGBM01Script property TourDone autoget tourdone if Tourdone > 1		return	else Tourdone=1		return	endif

I'm getting an EOF error at "if"
Spoiler
Starting 1 compile threads for 1 files...
Compiling "LGBM_TIF__0200B09F"...
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LGBM_TIF__0200B09F.psc(10,1): missing EOF at 'if'
No output generated for LGBM_TIF__0200B09F, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on LGBM_TIF__0200B09F
, and I think I need some sort of event, but I don't know what to put in. I just want to set Tourdone to 1 if it hasn't been incremented yet. I tried jamming in an OnInit, but no joy (I honestly don't know much about events, but I thought that would tick off ANYthing). I feel like there's a simple step I am skipping, but after hours of looking at the wiki and other posts, I'm still drawing a blank.

Note: I've been able to just set the variable in another dialogue fragment with
(getOwningQuest() as LGBM01Script).TourDone.setValue(3)
but when I try to use that in the CK editor, I do this:
Spoiler
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 1Scriptname LGBM_TIF__0200B09F Extends TopicInfo Hidden;END FRAGMENT CODE - Do not edit anything between this and the begin comment(getOwningQuest() as LGBM01Script).TourDone.getValue()	if (Tourdone > 1)		return	else Tourdone.setValue (1)		return	endif

Starting 1 compile threads for 1 files...
Compiling "LGBM_TIF__0200B09F"...
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\LGBM_TIF__0200B09F.psc(7,0): missing EOF at '('
No output generated for LGBM_TIF__0200B09F, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on LGBM_TIF__0200B09F

Confusion reigns.
User avatar
Evaa
 
Posts: 3502
Joined: Mon Dec 18, 2006 9:11 am

Post » Wed Jun 20, 2012 1:47 pm

Bump?
User avatar
Holli Dillon
 
Posts: 3397
Joined: Wed Jun 21, 2006 4:54 am

Post » Wed Jun 20, 2012 2:20 pm

The missing EOF error happens when the parser finds code that should be within an Event Or Function. So yes you're right.

The Fragment scripts are auto-generated, and they will place your fragment code within Function blocks for you.
The Function blocks will be called at the correct time; eg. at the start of a line of dialog.
So it just looks like you need to enter your code in the fragment window within the CK, and not append it to the script itself.

First, click on the Properties window of the fragment and Add a new property. GlobalVariable pTourDone
;This is your fragment code.If pTourDone.getValue() < 1  pTourDone.setValue(1)EndIf

You will rarely need to manually edit the fragment script.
User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

Post » Wed Jun 20, 2012 12:24 am

The missing EOF error happens when the parser finds code that should be within an Event Or Function. So yes you're right.

The Fragment scripts are auto-generated, and they will place your fragment code within Function blocks for you.
The Function blocks will be called at the correct time; eg. at the start of a line of dialog.
So it just looks like you need to enter your code in the fragment window within the CK, and not append it to the script itself.

Gaagh! Forgot about the auto-generated function blocks! Thanks for the reminder, I really need to stop skull-sweating things out and let the CK do things for me when I can get away with it - I'm obviously not very good at this, and any and all shortcuts I can find I need to take.


First, click on the Properties window of the fragment and Add a new property. GlobalVariable pTourDone
;This is your fragment code.If pTourDone.getValue() < 1  pTourDone.setValue(1)EndIf
You will rarely need to manually edit the fragment script.

Yay, much much cleaner, and we DO like neatness! Thanks tunaisafish!! :D
User avatar
RUby DIaz
 
Posts: 3383
Joined: Wed Nov 29, 2006 8:18 am


Return to V - Skyrim