Jump to content

Checking Properties From Another Script


Recommended Posts

Ok, so I'm trying to check a property used in a different script, in this case the bard handling quest. Everywhere I can find says that the way to do this is:

(Quest as OtherScript).PropertyName

 

But I get an error saying that it isn't a property (Which it is!)

 

Here is the actual script fragment:

Event OnUpdate()
If((BardSongs as BardSongsScript).Playing == 0) && (BardRef.IsInDialogueWithPlayer() == False) && (BardRef.IsEnabled())
(BardSongs as BardSongsScript).PlaySongRequest(BardRef,"Instrumental")
RegisterForSingleUpdate(10.0)
EndIf
EndEvent

 

And I always get this error:

"Playing is not a property on script bardsongsscript or one of its parents"

 

This is the property as established in BardSongsScript:

Int Playing = 0 Conditional

 

 

Does anybody know why this isn't working, and how to do it correctly? Does is have anything to do with the "conditional" setting?

Link to comment
Share on other sites

Int Playing = 0 Conditonal is not a property but a local variable on that script. You cannot reference that variable from other scripts. At least not without re-writing the BardSongsScript to make it a property variable. Properties that you can access via other scripts have the word "Property" within the declaration.

Link to comment
Share on other sites

  • 2 weeks later...

just another approach for bardsongs to update, no idea it's working or not

 

 

 

  Quest PROPERTY BardSongs auto                       ; vanilla quest

  Scene[] PROPERTY BardSongsArray auto                ; prefill by CK with next vanilla scenes
    ; Scene Property BardSongsBallad01Scene auto
    ; Scene Property BardSongsBallad01WithIntroScene auto
    ; Scene Property BardSongsDrinkingSong01Scene auto
    ; Scene Property BardSongsDrinkingSong01WithIntroScene auto
    ; Scene Property BardSongsDrinkingSong03Scene auto
    ; Scene Property BardSongsDrinkingSong03WithIntroScene auto
    ; Scene Property BardSongsDrinkingSong02Scene auto
    ; Scene Property BardSongsDrinkingSong02WithIntroScene auto
    ; Scene Property BardSongsInstrumentalFlute01 auto
    ; Scene Property BardSongsInstrumentalFlute02 auto
    ; Scene Property BardSongsInstrumentalLute01 auto
    ; Scene Property BardSongsInstrumentalLute02 auto
    ; Scene Property BardSongsInstrumentalDrum01 auto
    ; Scene Property BardSongsInstrumentalDrum02 auto
    ; Scene Property BardSongsInstrumentalFluteonly01 auto
    ; Scene Property BardSongsInstrumentalFluteonly02 auto
    ; Scene Property BardSongsInstrumentalBard2Drum01 auto
    ; Scene Property BardSongsInstrumentalBard2Drum02 auto
    ; Scene Property BardSongsInstrumentalWedding01 auto
    ; Scene Property BardSongsInstrumentalWedding02 auto


EVENT OnUpdate()
    myF_TryToPlay()
ENDEVENT


;-----------------------
FUNCTION myF_TryToPlay()
;-----------------------
    referenceAlias RA = (BardSongs as BardSongsScript).BardSongs_Bard
    objectReference oRef

    IF ( RA )
        oRef = RA.GetReference()
    ENDIF

IF ( oRef )
ELSE
    RETURN    ; - STOP -    bard not available
ENDIF
;---------------------
IF oRef.IsDisabled()
    RETURN    ; - STOP -    bard is disabled
ENDIF
;---------------------
IF oRef.IsInDialogueWithPlayer()
    RETURN    ; - STOP -    bard is talking with player
ENDIF
;---------------------
    int i = BardSongsArray.Length
    WHILE (i > 0)
        i = i - 1
        scene sc = BardSongsArray[i]
        IF (sc) && sc.IsPlaying()
            RegisterForSingleUpdate(5.0)
            RETURN    ; - STOP -    bard is already playing an instrument or performing a song
        ENDIF
    ENDWHILE

    IF oRef.Is3DLoaded()
        (BardSongs as BardSongsScript).PlaySongRequest(oRef, "Instrumental")
        RegisterForSingleUpdate(10.0)
    ENDIF

; *** BardSongsScript as follow *********************************************
;        BardHandoff           = Bard              ; oRef
;        InstrumentHandoff     = Instrument        ; "Instrumental"
;        PlayContinuousHandoff = PlayContinuous    ; TRUE
;        SongToPlayHandoff     = SongToPlay        ; 0
;        ChangeSettingsHandoff = ChangeSettings    ; TRUE
;        RegisterForSingleUpdate(1.0)
;        PlaySong(BardHandoff, InstrumentHandoff, PlayContinuousHandoff,SongToPlayHandoff, ChangeSettingsHandoff)

ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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