Jump to content

Scripting Question - display a message only once?


XunAmarox

Recommended Posts

I made myself a disenchanting script and I'm wanting it to show a help message the first time it's used like weapon racks do but the message is displaying every time. Here's my script:

Scriptname aaXunDisenchantingScript extends ObjectReference  
{Script handles the disenchanting of objects.}

ObjectReference Property PlayerRef Auto
;1 = if something is in this trigger, 0 = empty

Message Property RenewalFontMSG auto

Bool Property MessageAlreadyShown Auto

GlobalVariable Property RFontGlobal Auto
{Global that determines if you have seen the help message yet or not}

Event onActivate(ObjectReference akActionRef)    
MessageAlreadyShown = RFontGlobal.GetValue()
 
    if (MessageAlreadyShown == FALSE)
        ; If the help message hasn't been shown before then show it.
        RenewalFontMSG.Show()
        RFontGlobal.SetValue(1)
    elseif (MessageAlreadyShown == TRUE)
        debug.notification("Place an item.")
    EndIf
EndEvent

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    RemoveItem(akBaseItem, aiItemCount)
    Game.GetPlayer().AddItem(akBaseItem, aiItemCount)
EndEvent

It's the little bit there in the middle, the onActivate event. It's like either RFontGlobal.SetValue(1) isn't setting it to 1 or maybe MessageAlreadyShown == FALSE isn't checking MessageAlreadyShown = RFontGlobal.GetValue().

 

The script compiles just fine, it's just that it always displays the message like my value isn't getting either read or set or something...

 

Could anyone take a look at it and tell me what is wrong?

 

edit: Nevermind, got it fixed.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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