Print current Event List statement

Is it possible to print the current event list statement from an Daemon Object Event List?

My Daemon script is below and I would like to have something like this when the event list is at this statement.

X Fireplace
The fire is beginning to die down.

fireObj: EventList

    eventList =
    [
        'The fire crackles and pops. ',

        'The fire is beginning to die down. ',

        'The fire begins cool and smolder. ',

        
         &fireOut

    ]
    
    fireOut()
    {
        "The ashes in the fireplace are cool and gray. The fire is completely out. ";
        insideFireBox.fireOut = true;
  

    }
    
    start()
    {
        if(daemonID == nil)
            daemonID = new Daemon(self, &fireDies, 4);       
    }
    
    stopDaemon()
    {
        if(daemonID != nil)
        {
            daemonID.removeEvent();
            daemonID = nil;
            
        }
    }
    
    daemonID = nil
    scriptEnd = nil
    
    fireDies()
    {
        if(me.isIn(sittingRoom) || me.isIn(diningRoomCastle))
           doScript();
    }

;
2 Likes

If I understand you correctly, I think you want something like:

fireplace:Fixture 'fireplace'
    desc()
    {
           local lst = fireObj.eventList;
           local idx = fireObj.getScriptState();            
           if(idx > lst.length())
              idx =  lst.length();
           fireObj.doScriptEvent(lst[idx]);
     }
;

Or depending on the timing of events, you may need:

local idx = fireObj.getScriptState() - 1;   

A potential problem, which doesn’t look like it should be an issue in your code, is the side effects that might result from repeated evaluation of the event list.

3 Likes