-
Notifications
You must be signed in to change notification settings - Fork 6
Examples
cobrapitz edited this page Oct 29, 2019
·
22 revisions
onready var console = $Console
func _ready():
var printVariantRef = CommandRef.new(self, "my_variant_print", CommandRef.VARIANT)
var printVariantCommand = ConsoleCommand.new('printVariant', printVariantRef, 'Custom print.')
console.add_command(printVariantCommand )
var printThreeRef = CommandRef.new(self, "my_three_print", 3)
var printThreeCommand = ConsoleCommand.new('printThree', printThreeRef , 'Custom print.')
console.add_command(printThreeCommand )
# VARIANT version (called with: /printVariant print this please !!!)
func my_variant_print(args : Array):
for msg in args:
print("This is my first message: %s" % msg)
# 3-arguments version (called with: /printVariant print this please)
func my_three_print(arg1, arg2, arg3):
print("your args: %s %s %s" % [arg1, arg2, arg3])
console.write_channel("DebugChannel", "This is debug text(indented)", ConsoleFlags.Type.INDENT)
# or
console.write_line_channel(...)
console.write("test", flags)
# or
console.write_line(...)console.warn("This is a warning in yellow")
console.error("This is a error message in red")
console.success("This is a succes message in green")
# additional: [WARNING], [ERROR] or [SUCCESS] appended in log file