using { /Fortnite.com/Devices } # Rule 1: real module, opened with using using { /Verse.org/Simulation } # needed for agent and @editable # Rule 6: one focused job — this device only manages a simple win condition win_tracker := class(creative_device): @editable WinButton : button_device = button_device{} # Rule 1: real device type WinningScore : int = 1 # Part 3: a constant var CurrentScore : int = 0 # Part 3: a variable OnBegin() : void = # Part 4: real startup event WinButton.InteractedWithEvent.Subscribe(OnWinPressed) # Rule 1 + Part 4 # Rule 5: changes state, so ; validate before acting OnWinPressed(Agent : agent) : void = if (CurrentScore < WinningScore): # Rule 4: check first set CurrentScore += 1 # then change state Print("We have a winner!") # Rule 7: leave a trail