# We need to import our tools using { /Fortnite.com/Devices } using { /Fortnite.com/Devices/Patchwork } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main script. It is a creative_device. # A creative_device is the base class for all Verse scripts # that live in a UEFN level. PianoRabbitScript := class(creative_device): # This is a Variable. # It will hold the Note Sequencer device. # Think of it as a remote control for the music. # note: note_sequencer_device is the real UEFN device type. @editable NoteSeq : note_sequencer_device = note_sequencer_device{} # This is another Variable. # It will hold the Prop Mover. # Think of it as the dancer. # note: prop_mover_device is the real UEFN device type. @editable Dancer : prop_mover_device = prop_mover_device{} # This is a Function. # A function is a recipe. It does one job. # This function starts our music. OnBegin() : void = # Now we listen for events. # Every time the sequencer finishes one full loop, # we do something. This is the Event connection. # note: NotePlayedEvent does not exist on note_sequencer_device; # SequenceCompleteEvent fires at the end of each loop and is # the closest real signal this device exposes. NoteSeq.SequenceCompleteEvent.Subscribe(OnNotePlayed) # This function runs when the sequence completes a loop. # It is called by the Event above. OnNotePlayed() : void = # We print a message to the output log. # This helps us debug. Debugging is fixing bugs. Print("Sequence loop completed — beat fired!") # Now we make the dancer jump. # We tell the prop mover to begin its movement, # which plays the move it was configured with # in its device settings. # note: prop_mover_device has no Activate(); Begin() triggers # the authored movement path defined in the editor. Dancer.Begin()