Files

103 lines
2.8 KiB
Plaintext

# Sample ASHES script for testing the VS Code extension
# This file demonstrates various ASHES language features
:setup
# Global variable declarations
global game_started = false
global player_name = "Player"
global score = 0
# Local variables
var tutorial_completed = false
var current_room = "intro"
# Set initial state
set_global("game_started", true)
set_active($player, true)
teleport($player, $start_position)
:ready
# Check if this is the first time
if !game_started:
say($player, "Welcome to the game!", "welcome_message")
game_started = true
else:
say($player, "Welcome back!", "welcome_back")
:action1
# Simple interaction
say($player, "You examine the object carefully.", "examine_object")
# Check inventory
if $magic_key in inventory:
say($player, "You have the magic key!", "has_key")
else:
say($player, "You need a key to proceed.", "needs_key")
:action2
# Dialog system example
say($player, "You approach the mysterious character.", "approach_character")
?!
- "Hello, who are you?" [!name_known]
say_last_dialog_option()
say($npc, "I am the guardian of this place.", "guardian_intro")
global name_known = true
- "Can you help me?" [name_known]
say_last_dialog_option()
say($npc, "I can guide you, but you must prove yourself.", "guardian_help")
?!
- "How can I prove myself?"
say_last_dialog_option()
say($npc, "Find the three ancient artifacts.", "guardian_task")
- "I'm not interested."
say_last_dialog_option()
say($npc, "Very well, good luck on your own.", "guardian_dismiss")
done
- "Goodbye"
say_last_dialog_option()
say($npc, "Farewell, traveler.", "guardian_farewell")
done
:action3
# Complex logic example
var artifacts_found = 0
# Check for artifacts
if $artifact1_collected:
artifacts_found += 1
if $artifact2_collected:
artifacts_found += 1
if $artifact3_collected:
artifacts_found += 1
# Conditional responses
if artifacts_found == 3:
say($player, "I have found all three artifacts!", "all_artifacts")
change_scene("res://rooms/victory_room.tscn")
elif artifacts_found > 0:
say($player, "I have found " + str(artifacts_found) + " artifacts so far.", "some_artifacts")
else:
say($player, "I haven't found any artifacts yet.", "no_artifacts")
:use | TK
# Use with item
if $magic_key in inventory:
say($player, "You use the magic key.", "use_key")
set_active($locked_door, false)
play_snd("res://sounds/door_open.ogg", _sfx)
else:
say($player, "You can't use this without the right item.", "cant_use")
:look
# Look action
say($player, "You look around carefully.", "look_around")
# Conditional descriptions
if $secret_door is active:
say($player, "You notice a hidden passage.", "hidden_passage")
else:
say($player, "Nothing unusual catches your eye.", "nothing_unusual")
# End of sample script