The Dink Network

Notepad++ Python scripts for DinkC

June 9th 2014, 07:13 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
TL;DR: DinkC_Talk.py DinkC_Choice.py.

Disclaimer: I don't claim that this is particularly good Python code. Also, if the scripts somehow ruin your file, they respect Ctrl+Z. If they somehow don't, tough luck.

I've had these scripts for personal use for a while, but I may as well share them. They're Python scripts for Notepad++, though people using another editor with Python support will hopefully find it easy to salvage the good bits.

For this to work, you must first install the "Python Script" plugin. Install it from the plugin manager (the "Plugins->Plugin Manager->Show Plugin Manager" option from the menu). Having done that, put the files in "C:\Users\YOURUSERNAMEHERE\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts" .

If they don't show up in the "Plugins->Python Script->Scripts" menu, restarting Notepad++ may help.

Anyway, to the scripts:

DinkC_Talk.py

This greatly simplifies conversations. Put the following code in a file somewhere:

//< 4
//& 120
> Hi, who are you?
< I'm Bob!
> Howdy, Bob. I'm Dink.
< Nice to meet you, Dink.


Select the script from the menu. It suddenly looks like:

//< 4
//& 120
say_stop("Hi, who are you?",1);
wait(120);
say_stop("`4I'm Bob!",&current_sprite);
wait(120);
say_stop("Howdy, Bob. I'm Dink.",1);
wait(120);
say_stop("`4Nice to meet you, Dink.",&current_sprite);
wait(120);


As you see, "//& 120" specifies the wait() to use between lines. Some people like this, some people don't. If there's no "//&" line, or a "//& 0" line, no wait() will be added.

"//< 4" sets the speech colour of the other person to '4'. These are the same numbers as set_font_color() uses, and they translate to the same colour code. So "//< 15" will produces lines that start with "`%".

If you have more than one character, or you don't want to talk to &current_sprite, you can do this:

//< 4 &duck
//+ 15 &death
> Hello? Who are you?
< QUACK!
+ DIE!
> Oh, okay. Bye.
< Quack?
> Shut it, duck.
+ Yes. Shut it, duck.


It'll become:

//< 4 &duck
//+ 15 &death
say_stop("Hello? Who are you?",1);
say_stop("`4QUACK!",&duck);
say_stop("`%DIE!",&death);
say_stop("Oh, okay. Bye.",1);
say_stop("`4Quack?",&duck);
say_stop("Shut it, duck.",1);
say_stop("`%Yes. Shut it, duck.",&death);


Any single character after "//" will define a character shorthand that you can use in conversations. Except &, because that's for waits.

DinkC_Choice.py

This auto-generates if-statements for choice menus.

---
set_y 240
set_title_color 15
+++
Good morning, Dink!
+++
"Good morning!"
"How's the farm doing?"
(&story == 3) "Can I get a turnip?"
(&story > 5)(&bearbutts > 0) "I have some more bear butts for you."
---


Turns into:
choice_start();
set_y 240
set_title_color 15
title_start();
Good morning, Dink!
title_end();
"Good morning!"
"How's the farm doing?"
(&story == 3) "Can I get a turnip?"
(&story > 5)(&bearbutts > 0) "I have some more bear butts for you."
choice_end();

// Good morning!
if (&result == 1)
{
  
}

// How's the farm doing?
if (&result == 2)
{
  
}

// Can I get a turnip?
if (&result == 3)
{
  
}

// I have some more bear butts for you.
if (&result == 4)
{
  
}



This works the way you may guess. The first line to have "---" gets replaced by choice_start(). The first line to have "+++" gets replaced by title_start(), the second "+++" is title_end(), and the second "---" is choice_end().

Any lines that are not between the two "+++"-lines and have quotes in them are interpreted as a choice option. Yes, even when it's between the first "---" and the first "+++". The script is not particularly clever. The text between the quotation marks is used to generate the comment in front of the if-statement.

I hope these scripts are of use to someone else.
June 9th 2014, 08:31 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
This looks ridiculously helpful.
I DEMAND A STICKEY.
June 10th 2014, 02:30 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Ha! You finally got them out.

I'm fine with my own conversation maker, so I'll stick with that. Though it doesn't have the choice menu creator which also sounds mightily handy...