Using ShuffledEventList Within a Room

I’m trying to use the ShuffledEventList (there might be a better solution, this is what I’ve uncovered so far) to randomly check to see if the player gets trapped in a pantry. Currently I have it just within the room’s definition and am trying to run it when the room is described. Once I get this working I want to modify it to do the check during other actions within the room like examining shelves etc. Here is the code I have so far - when I enter the pantry I get a ‘cannot convert value to string’ error. So I need to call this function some other way. How would I go about doing a random check, and code one of the check results to modify objects (like shutting and locking a door etc)? Here is my malfunctioning code:

Pantry: Room
    roomName = 'Pantry'
    desc = "The pantry is cold and damp. Its walls are lined with brushed metal.
        A single electric light shines from the middle of the ceiling.
        Shelves cover the north, east and west walls.
        Large cans of food fill the shelves and beneath them are stacked sacks
        of flour, rice and dried beans.
        The south wall is bare except for the thick door leading to the kitchen.
        Aprons hang from a hook in the center of the pantry door.
        <<navDesc>> "

    navDesc = "
        enter kitchen (south)"

    trapCheck: ShuffledEventList {[
        'As you look around something flashes across one of the windows. At first you assume it is a reflection and frantically
        look around you, but it is outside. The moving shape was too fast for you to identify, but it looked large. ',
        new function()
             "With a loud <i>crack</i> the floor suddenly gives way, and you 
              suddenly find yourself falling...";

    south = pantryDoor;

I haven’t tested this, but I think you need to call <<trapCheck.doScript>> in the room description. The error message is telling you the output buffer needs to receive string (text) data. But <> isn’t a string, it’s a value.