Some folks asked me to share some code I showed off in another thread, and I decided I should start a thread where we can all share any code/decks/contraptions/modules we think may be useful for the jam. I'll start off with this.
This here is my dialog formatter! Basically, it takes some basic text and gives fonts to character names and adds commands automatically.
One of the first things I wrote in Decker, so hopefully it's not too buggy. Since it's pretty involved, I decided to upload it into it's own deck, with tables and such set up already for you to use! The deck includes some documentation and steps on how to get it into your project, but basically:
- Copy the settingsDialog card into your project (can do this by going to the card, and clicking on the menu options Card -> Copy Card. then go to your project and do Edit -> Paste Card)
- Copy the top level deck script into your project's top level deck script (go to File -> Properties -> Script)
- Make sure you have the dd and pt modules.
- And now go wild! Edit the chars table to match your characters. The script puts character names on their own line, but feel free to go into the code and change that (look for new_format in the dd_format_helper method).
- To use, call dd_format in addition to dd.say. The deck shows some examples of this.
Not entirely sure how to upload the deck here, so for now I'm just putting it in a pastebin lol (don't like using google drive or whatever)
Download the text file, and then do either of these:
- Rename the file and replace .txt with .deck. This will convert it into a decker file.
- Drag the file onto the decker.exe, and it will open the file. Save the file as a decker file.
Feel free to use this with or without credit. Let me know if you run into any bugs! Maybe I'll turn this into a contraption at some point and upload it to the Decker forums, but for now this works hehe.