Server Debug Aid
By
ChemCreated: 2015/03/14 13:48:08 UTC-07:00 (9 years and 285 days ago)
Edited: 2015/03/14 13:48:08 UTC-07:00 (9 years and 285 days ago)
Likes: 1
Denizen Version: Version
Script Version: 1.0
Description:
Some debuggging that records the server errors from your scripts.
It creates folder that are named the file containing your script.
In those folders are files named the individual script that contains the error.
Each line in the file contains all the data that can be obtained about the script, queue, player, npc.
There is a lot of useless data that might be recorded about your script and if the error occurs frequently enough, the files will get big quickly. The bigger the file, the more work youll need to do to fix it.
There is the ability to determine the line that the error occured on and the ability for denizen to auto correct common mistakes, even provide the correct usage for the erroring command. If I get enough messages on the denizen irc. "!msg Chem "I want that debugging and autofixing you were talking about." Id be quicker about getting out a more advanced version of this.
Future ideas todo:
Build auto correct
Generate erroring loc in the text.
Store data in yaml format for easy data output / error finding
Auto submit denizen exceptions and auto record data / errors and output as a mcmonkey link.
Generate link for documentation for correct usage of dcommands.
Download script |
View raw script#################################################################################################################################
# #
# A Set of debugging ideas that might be useful for others. #
# #
# #
#################################################################################################################################
#todo: have the server flaged to output to a type of output.
# log
# console
# to_ops
# to_flagged
# none
#todo: Create a yaml object representing the error for storage while the server runs
#todo the output feature will read a yaml object thats a culmulation of the error
#yaml object should contain
# relative file name
# The error message
#The error yaml file should be ordered by
# error type: ex, invalid tag, exceptions, command errors....
# script:
# line of erroring code
#
#Possible to determine a failed ./ex command
# queue.id.split[_].contains[EXCOMMAND]
#
# #loc/yaml_keys[<<>def[script]<>>].size|
# #step/step[<<>player<>>]|
# #assigned_to/get_npcs_assigned[<<>def[script]<>>]
ScriptDebug:
type: world
script_error_object_file: script_error_objects.yml
events:
on script generates error:
- if !<server.has_flag[debug_output]> queue clear
# - if <context.script||none> != none {
# - yaml
# load:<context.script.relative_filename>
# id:<context.script.name>
#
# - run "Build Yaml Error Object"
# def:<context.message>|<context.queue>|<context.script>
# }
- define player "
Uneven number of "quotes"
<context.queue.player||
Line with no clear purpose - missing a -dash- or :colon:?
<queue.player||
Line with no clear purpose - missing a -dash- or :colon:?
<player||
Line with no clear purpose - missing a -dash- or :colon:?
none>>>"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
- define npc "
Uneven number of "quotes"
<context.queue.npc||
Line with no clear purpose - missing a -dash- or :colon:?
<queue.npc||
Line with no clear purpose - missing a -dash- or :colon:?
<player.selected_npc||
Line with no clear purpose - missing a -dash- or :colon:?
none>>>"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
- define queue
<context.queue||none>
Line with no clear purpose - missing a -dash- or :colon:?
- define script
<context.script||none>
Line with no clear purpose - missing a -dash- or :colon:?
- inject "get debug data"
#ignored printing data based off of whats generated in the script get debug data
- define ignored_data
li@none|ignored_data|loop_index|value|type|accessor|attribute|object|accessor_types|npc_accessors|player_accessors|queue_accessors|script_accessors
Line with no clear purpose - missing a -dash- or :colon:?
- define ignored_data
<def[ignored_data].include[player_list_flags]>
Line with no clear purpose - missing a -dash- or :colon:?
- if <def[script].relative_filename||none> != none {
- define file_location <def[script].relative_filename.split[<&dot>].get[1]>
- define file_location /plugins/denizen<def[file_location]>
- define file_name <def[script].name>_errors.log
} else {
- define file_location /plugins/denizen/scripts
- define file_name general_errors.log
}
- define file <def[file_location]>_error_log/<def[file_name]>
#- announce "file<&co> <def[file]>"
#- define file /plugins/denizen/script_errors.log
#output
- announce "<red>[<def[script].name||NOSCRIPT>] <blue><context.message>"
- log "=======<script.name>=======" type:warning file:<def[file]>
- log "Script<&co> <&lb><def[script].name||Unknown Script><&rb> <--- Generated an error." type:none file:<def[file]>
- log "The message is as follows<&co>" type:none file:<def[file]>
- log "<context.message>" type:none file:<def[file]>
- foreach <queue.definitions.alphanumeric> {
- if <def[ignored_data].contains[<def[value]>]>
|| <def[%value%]> == none {
Line with no clear purpose - missing a -dash- or :colon:?
- foreach next
}
- log "<&lb><def[value]><&rb> <def[%value%]>" type:none file:<def[file]>
}
- log "=======Finished with Debug Data=======" type:none file:<def[file]>
on server generates exception:
#- if !<server.has_flag[debug_output]> queue clear
#- run "Notify Debug" def:<context.message>|<context.queue||none>|<context.script||none> instantly
Get Debug Data:
#
# INJECTED SCRIPT
# This script defines data based on the definitions within
#
#this requires definitions to be already defined,
# - define player <player>
# - define player <queue.player>
# - define queue <context.queue>
# - define script <s@testing_sorta>
# - define npc <player.selected_npc>
type: task
script:
- define queue_accessors "
Uneven number of "quotes"
id/id|
Line with no clear purpose - missing a -dash- or :colon:?
size/size|
Line with no clear purpose - missing a -dash- or :colon:?
state/state|
Line with no clear purpose - missing a -dash- or :colon:?
script/script|
Line with no clear purpose - missing a -dash- or :colon:?
determination/determination|
Line with no clear purpose - missing a -dash- or :colon:?
type/type|
Line with no clear purpose - missing a -dash- or :colon:?
speed/speed|
Line with no clear purpose - missing a -dash- or :colon:?
commands/commands|
Line with no clear purpose - missing a -dash- or :colon:?
debug/script.debug|
Line with no clear purpose - missing a -dash- or :colon:?
definitions/definitions"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
- define script_accessors "
Uneven number of "quotes"
container_type/container_type|
Line with no clear purpose - missing a -dash- or :colon:?
cooled_down/cooled_down|
Line with no clear purpose - missing a -dash- or :colon:?
filename/filename|
Line with no clear purpose - missing a -dash- or :colon:?
relative_filename/relative_filename|
Line with no clear purpose - missing a -dash- or :colon:?
name/name|
Line with no clear purpose - missing a -dash- or :colon:?
debug/debug|
Line with no clear purpose - missing a -dash- or :colon:?
prefix/prefix|
Line with no clear purpose - missing a -dash- or :colon:?
object_type/object_type"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
#loc/yaml_keys[<<>def[script]<>>].size|
#step/step[<<>player<>>]|
#assigned_to/get_npcs_assigned[<<>def[script]<>>]
- define npc_accessors "
Uneven number of "quotes"
id/id|
Line with no clear purpose - missing a -dash- or :colon:?
spawned/spawned|
Line with no clear purpose - missing a -dash- or :colon:?
owner/owner|
Line with no clear purpose - missing a -dash- or :colon:?
name/name|
Line with no clear purpose - missing a -dash- or :colon:?
nickname/nickname|
Line with no clear purpose - missing a -dash- or :colon:?
protected/is_protected|
Line with no clear purpose - missing a -dash- or :colon:?
lookclose/lookclose|
Line with no clear purpose - missing a -dash- or :colon:?
previous_location/.location.previous_location.simple|
Line with no clear purpose - missing a -dash- or :colon:?
location/location.simple|
Line with no clear purpose - missing a -dash- or :colon:?
nav_target/navigator.target_location|
Line with no clear purpose - missing a -dash- or :colon:?
teleport_on_stuck/teleport_on_stuck|
Line with no clear purpose - missing a -dash- or :colon:?
navigating/navigator.is_navigating|
Line with no clear purpose - missing a -dash- or :colon:?
base_speed/navigator.base_speed|
Line with no clear purpose - missing a -dash- or :colon:?
range/navigator.range|
Line with no clear purpose - missing a -dash- or :colon:?
attack_range/navigator.attack_range|
Line with no clear purpose - missing a -dash- or :colon:?
stratagey/navigator.attack_stratagey|
Line with no clear purpose - missing a -dash- or :colon:?
speed_modifier/navigator.speed_modifier|
Line with no clear purpose - missing a -dash- or :colon:?
speed/navigator.base_speed|
Line with no clear purpose - missing a -dash- or :colon:?
avoid_water/navigator.avoid_water|
Line with no clear purpose - missing a -dash- or :colon:?
base_speed/navigator|
Line with no clear purpose - missing a -dash- or :colon:?
has_assignment/has_script|
Line with no clear purpose - missing a -dash- or :colon:?
script/script|
Line with no clear purpose - missing a -dash- or :colon:?
flags/list_flags|
Line with no clear purpose - missing a -dash- or :colon:?
engaged/is_engaged|
Line with no clear purpose - missing a -dash- or :colon:?
anchors/anchor.list|
Line with no clear purpose - missing a -dash- or :colon:?
inventory/inventory.list_contents|
Line with no clear purpose - missing a -dash- or :colon:?
traits/traits|
Line with no clear purpose - missing a -dash- or :colon:?
nearby_npcs/location.find.npcs.within[25]"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
- define player_accessors "
Uneven number of "quotes"
name/name|
Line with no clear purpose - missing a -dash- or :colon:?
display_name/name.display|
Line with no clear purpose - missing a -dash- or :colon:?
list_name/name.list|
Line with no clear purpose - missing a -dash- or :colon:?
entity_id/eid|
Line with no clear purpose - missing a -dash- or :colon:?
save_name/save_name|
Line with no clear purpose - missing a -dash- or :colon:?
prefix/prefix|
Line with no clear purpose - missing a -dash- or :colon:?
selected_npc/selected_npc|
Line with no clear purpose - missing a -dash- or :colon:?
is_op/is_op|
Line with no clear purpose - missing a -dash- or :colon:?
location/location.simple|
Line with no clear purpose - missing a -dash- or :colon:?
chat_history/chat_history_list|
Line with no clear purpose - missing a -dash- or :colon:?
target/target|
Line with no clear purpose - missing a -dash- or :colon:?
open_inventory/open_inventory|
Line with no clear purpose - missing a -dash- or :colon:?
is_op/is_op|
Line with no clear purpose - missing a -dash- or :colon:?
location/location.simple|
Line with no clear purpose - missing a -dash- or :colon:?
chat_history/chat_history_list|
Line with no clear purpose - missing a -dash- or :colon:?
target/target|
Line with no clear purpose - missing a -dash- or :colon:?
open_inventory/open_inventory|
Line with no clear purpose - missing a -dash- or :colon:?
item_on_cursor/item_on_cursor|
Line with no clear purpose - missing a -dash- or :colon:?
money/money|
Line with no clear purpose - missing a -dash- or :colon:?
list_flags/list_flags.alphabetical|
Line with no clear purpose - missing a -dash- or :colon:?
fall_distance/fall_distance|
Line with no clear purpose - missing a -dash- or :colon:?
debug/debug"
Uneven number of "quotes" / Line with no clear purpose - missing a -dash- or :colon:?
#this requires definitions to be already defined,
# - define player <player||none>
# - define player <queue.player||none>
# - define queue <context.queue||none>
# - define script <s@testing_sorta||none>
# - define npc <player.selected_npc||none>
#todo: maybe I might want to add to a list of attributes instead of creating definitions
#by reason of possibility of overwriting other definitions within a script
#thats why the definition created is %type%_%attribute% or npc_location instead of just location
- define accessor_types li@queue|script|player|npc
- foreach <def[accessor_types]> {
#store the type so its not overwritten later
- define type %value%
#get the calling scripts value
- define object <def[%value%]||none>
#if there was a failed or no definition at all
- if <def[object]> == none foreach next
#foreach local definitions, queue_accessors, etc...
- foreach <def[%type%_accessors].as_list> {
#split the name from the accessor value
- define attribute <def[value].split[/].get[1]>
- define accessor <def[value].split[/].get[2]>
##access the attributes on the calling scripts object. eg player.name, queue.size, etc...
- define %type%_%attribute% <def[object].%accessor%||none>
}
}
View History