Skip to content

Instantly share code, notes, and snippets.

@FelixWolf
Created August 19, 2024 17:39
Show Gist options
  • Save FelixWolf/b4e38d7e95ea99e56d357f0918fa8895 to your computer and use it in GitHub Desktop.
Save FelixWolf/b4e38d7e95ea99e56d357f0918fa8895 to your computer and use it in GitHub Desktop.
Dragonspeak variable debugger
*DS Variable debugger
*Created by Kyler "Felix Wolf" Eastridge
* DS variable debugger. Usage:
* `!getintvar <index>` - Get int variable
* `!setintvar <index> <x> [y]` - Set int variable to a value
* `!getstrvar <index>` - Get string variable
* `!setstrvar <index> <value>` - Set a string variable to a value. (Quotes allowed, intentionally avoided `[PARAM2]` to allow for quotes.)
* `!getstrtable <index>` - Retrieve a DS string table (the .txb file)
*
* *You have to know the indexes to access them!* This does not allow you to query them by name.
* Variables are indexed by their first occurance in the DS file! Note that integer variables are stored as `(x, y)` tuples, even if you aren't using the `y` component, thus all integer variables will be shown as a 2D vector. You can skip the`y` component if you don't want to use it. It'll default to zero.
* This makes the assumption that `!` is the silence prefix. It does not set it on it's own.
* Line weight: 41
* Integer variable weight: 2
* String variable weight: 2
* String table weight: 17
* DS size weight: 820 bytes
(0:30) When someone says anything,
(5:250) set message ~CMD to {[CMD]}.
* Integer variables
* `@0` means to access integer variable 0. This just adds the variable offset(`50000` in unsigned uint16. `-15536` in signed) to the number given.
(0:32) When someone says something with {!getintvar } in it,
(1:75) and message ~CMD contains {!getintvar} somewhere within it,
(1:10) and they are the Dream owner,
(5:314) set variable %where to the number the triggering furre just said or emoted.
(5:310) use variable @0 as an array, and copy entry %where of it into variable %what.
(5:200) emit message {&#37;%where = %what.x, %what.y} to the triggering furre.
(0:32) When someone says something with {!setintvar } in it,
(1:75) and message ~CMD contains {!setintvar} somewhere within it,
(1:10) and they are the Dream owner,
(5:314) set variable %where to the number the triggering furre just said or emoted.
(5:250) set message ~tmp to {[PARAM3]}.
(5:282) set variable %what to the first number in ~tmp.
(5:384) set variable %what to the x,y position (0, %what).
(5:250) set message ~tmp to {[PARAM2]}.
(5:282) set variable %what to the first number in ~tmp.
(5:311) use variable @0 as an array, and set entry %where of it to %what.
(5:200) emit message {&#37;%where = %what.x, %what.y} to the triggering furre.
* String variables
* String variables, since they can't be used as integers, simply just use a index 0, so passing message 0 works fine here.
(0:32) When someone says something with {!getstrvar } in it,
(1:75) and message ~CMD contains {!getstrvar} somewhere within it,
(1:10) and they are the Dream owner,
(5:314) set variable %where to the number the triggering furre just said or emoted.
(5:275) use message 0 as an array, and copy entry %where of it into message ~tmp.
(5:200) emit message {&#126;%where = ~tmp} to the triggering furre.
(0:32) When someone says something with {!setstrvar } in it,
(1:75) and message ~CMD contains {!setstrvar} somewhere within it,
(1:10) and they are the Dream owner,
(5:250) set message ~tmp to {[CMD] [PARAM1] }.
(5:280) set variable %where to the length of message ~tmp in characters.
(5:255) set message ~tmp to what the triggering furre just said or emoted.
(5:274) chop off the beginning of message, ~tmp removing the first %where characters of it.
(5:314) set variable %where to the number the triggering furre just said or emoted.
(5:276) use message 0 as an array, and set entry %where of it to {~tmp}.
(5:200) emit message {&#126;%where = ~tmp} to the triggering furre.
* String table
(0:32) When someone says something with {!getstrtable } in it,
(1:75) and message ~CMD contains {!getstrtable} somewhere within it,
(1:10) and they are the Dream owner,
(5:314) set variable %where to the number the triggering furre just said or emoted.
(5:250) set message ~tmp to %where.
(5:200) emit message {#%where = ~tmp} to the triggering furre.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment