Contributing/Modding TW

From Era Wiki
Jump to: navigation, search

Original guide by Mr Pops A Lot


Era code is unlike most other programming languages, and thus broke feeble brains of many western porn addicts. Most people who just want to add dialogue get stuck at the learning EraBasic phase and often lose motivation before they can put their ideas on the page. This page will teach the basics of EraBasic and guides you to be able to mod TW and make your own content.

Hints[edit]

Consider temporarily removing resources and ERB/口上・メッセージ関連/個人口上 folders to speed up restart times, this would make development experience less painful.

The Language[edit]

Era games are made in EraBasic, a form of the BASIC programming language. It isn't a very advanced language like Lua or Ruby, but it's very easy to understand as a result

PRINT[edit]

EraBasic had a ton of commands just to output text which are all variations of the Print command.

PRINT[edit]

This outputs plain text in the current line without the ability to use expressions

PRINTFORM[edit]

PrintForm works like Print, but allows for in-line expressions with % and in-line IF statements using \@.

  • V - for numbers ({}); instead of "PRINTFORM {LOCAL}" you can write "PRINTFORMV LOCAL"

  • S - equivalent of strings (%%)
  • K - something with forcing kana (extremely rarely used)
  • D - ignores color change from SETCOLOR
  • L - makes line after printing the text
  • W - waits for player input

PRINT variants "S" or "V" should not be translated, they are for quick variable use without needing to write %% or {}

D is optional, and it goes before L or W.

L and W are mutually exclusive, but ideally every line should have one or the other.

PRINTDATA[edit]

PrintData works similarly to PrintForm, except that it randomly chooses between multiple single line statements.

Similar variant characters apply.

PRINTFORM Usage[edit]

String statements and expressions that return strings can be used with %% with the expression in the middle, and number expressions using {}.

LOCAL = 3

LOCALS = Tsukasa

PRINTFORML %LOCALS% has %LOCAL% cookies

Shortform IF statements can be used like this:

 \@ ARG ? True # False \@

Putting [] and a number will turn the print statement into a button.

PRINTBUTTON can also be used if you don't want to explicitly state the option ID. Keep in mind that you will have to wrap the text in " and put the ID it corresponds with a comma between. Putting a @ before the string statement will also allow %% and {} to be used.

PrintData

PRINTFORMDW Parsee stares at you 
PRINTDATAW
    DATAFORM 「Do not speak to me.」
    DATAFORM 「Go away.」

Conditional Statements[edit]

IF ARG >= 50
    ;if ARG is greater than or equal 50
ELSEIF ARG == 20
    ;if ARG equals 20
ELSE IF !ARG && !LOCAL
    ;if there's r no ARG nor LOCAL
ELSEIF ARG < 10 || ARG = 69
    ;if ARG is less than 10 or equal to 69
ELSE
    ;every other condition
ENDIF

IF statements can also be nested inside other IF statements and loops.

A single line IF statement can also be used which does not need an ENDIF to end the statement but can only be used with one line instructions

SIF ARG > 10
    PRINTFORM True!

Case statements can be used to define a range which determines which output is given from a input value

SELECTCASE ARG
    CASE 0
        ;ARG == 0
    CASE 5 TO 10
        ;ARG from 5 to 10
    CASE 11, 15, 69
        ;cases 11 15 and 69
    CASE IS > 100
        ;cases more than 100
    CASEELSE
        ;other cases
ENDSELECT

Loops[edit]

For loops are used to repeat a statement a certain amount of times, often manipulated by expressions.

FOR LOCAL, 0, 42
    ;loop that will go from 0 to 42 (excluding 42)
    ;LOCAL here is variable holding of current loop count
    SIF LOCAL == 5
        CONTINUE            ;it skips case 5 and goes to next one - that is 6
    ;stuff
    SIF LOCAL == 12
        BREAK               ;exits the loop completely, ignoring whether it's the last time (42 in this case)
NEXT

While loops repeat infinitely until the condition is given

WHILE !LOCAL
    ;this continues as long as LOCAL == 0
WEND

REPEAT is much like a FOR loop but does not allow for expressions

REPEAT 5
    ;repeats itself 5 times
    ;uses global variable COUNT for ... counting
REND

Changing Text Color[edit]

SETCOLOR 204, 0, 102            ;in rgb
SETCOLOR 0xff00ff               ;in hex
SETCOLOR C_RED                  ;it also supports constant variables
SETCOLOR FOO("red")   ;and functions

SETCOLORBYNAME Coral            ;use HTML color names

RESETCOLOR                      ;use this when you're finished with fancy coloring

Comments[edit]

Comments can be used to disable execution of code or if you want to have comments about the code you are writing.

A single line can be commented out using ;

Do not translate jap comments, but feel free to make your own comments relating to the code so others can interpret what you are trying to do.

For multiple line comments use [SKIPSTART] before the code you want to comment out and [SKIPEND] at the line after the code you want to comment.

Variables[edit]

There are two types of variables in EraBasic, integers and strings. Integer values can only hold whole numbers while strings can only hold text or numbers converted to strings.

LOCAL and LOCALS (s for string) are always available, even outside of a function.

The same is true for single letter variables (IE: X, Y, Z). Keep in mind that there's no string version of these single letter variables.

ARG and ARGS can be used inside of a function if it's defined and needed.

MASTER and PLAYER refer to the player character

You can put :Number to differentiate between LOCAL and ARG values.

LOCAL = 1
LOCALS = Rotor

LOCAL:1 = 2000
LOCALS:1 = Andy

PRINTFORML %LOCALS:1% bought {LOCAL} %LOCALS% for %LOCAL:1%.

; Andy bought 1 Rotor for 2000

#DIMs[edit]

Private variables have to be defined with #DIM or #DIMS at the start of the function. DIM is for integers and DIMS is for strings

@CUMME(ARG, PleasureAmount)
#DIM PleasureAmount
#DIMS ItemName

DIM variables can also be saved to the character, the save, or saved globally.

DIM values are often preferred over CSVs as they do not take a numerical ID and are easier to merge

Functions[edit]

There are two types of functions, CALL functions and RETURN functions.

ARG, ARGS, LOCAL, LOCALS, and private variables can be defined in a function and can default to a certain value if an argument is not given

CALL Functions[edit]

Call functions are the default type of functions and require CALL before the function name to be executed.

CALL functions can call other CALL functions and RETURN functions

@UselessThing(ARG, ARG:1 = 0)
LOCAL = GetCum(ARG) ;Set result of a return function

CALL CanSex(ARG, ARG:1)
LOCAL:1 = RESULT ; set result of a call function

IF LOCAL:1
    CALL StartUfufu(ARG, ARG:1)
    RETURN 1 ;condition is true
ELSE
    RETURN 0 ; return false
ENDIF

RETURN Functions[edit]

These functions are made to return an integer or a string and start with #FUNCTION or #FUNCTIONS depending on the return value.

They can only call other RETURN functions

@GetCum(ARG)

RETURN BASE:ARG:Cum ; returns the current value of the cum base

Operations[edit]

All operations are integer based

LOCAL ++                    ; increases the value by one
LOCAL --                    ; decreases value by one
LOCAL += 4                  ; increases value by 4
LOCAL -= 6                  ; decreases value by 6
LOCAL *= 3                  ; multiplies value by 3
LOCAL /= 10                 ; divides value by 10
LOCAL = LOCAL * 17 / 10     ; multiplies value by 1.7
LOCAL % 3                   ; divides the value by 3 and then returns the remainder

Random[edit]

RAND is a function that rolls a number between 0 and the number given, subtracted by 1. Doing !RAND means that it'll only proceed if it lands on 0. You can also do a custom number such as RAND(100), which rolls a number between 0 and 99

LOCAL = RAND(3,500)

IF RAND(100) < 70
;70% chance
    SIF !RAND:4
    ;25% chance
ENDIF

VARSET[edit]

VARSET resets variables back to a default value defined by the function. If no value is given, then it resets back to 0 or blank depending if it was a string or integer.

#DIM VS_TEST = 5
#DIM VS_INT
#DIMS VS_STR

VARSET VS_TEST ; resets this value back to 5
VARSET VS_INT ; resets this value back to 0, since we didn't define any value
VARSET VS_STR ; resets to blank

Strings[edit]

Strings in EraBASIC are handled weirdly depending on how they are parsed.

#DIMS STR_TEST = "A string" ;define STR_TEST with the value of "A string" (exclude quotations)
LOCALS = STR_TEST ; This defines LOCALS with the value of "STR_TEST". Note how this is treated as plaintext
LOCALS = %STR_TEST% ;This defines LOCALS with the value of "A string", note the % signs indicating that it's a string.
LOCALS '= STR_TEST ; This defines LOCALS like above. The '= means it's a string expression
LOCALS '= @"%STR_TEST%" ;This also works
LOCALS += @", but with more string" ; This adds ", but with more string" to the current value of LOCALS, which is "A string", turning it into "A string, but with more string"

EmueraEE Additions[edit]

All modern TW branches (Neodev, ATW, NAS, OTW) use additions in the EmueraEE (EE) interpreter for a multitude of reasons. Playing on a non-EE interpreter will result in the game being unable to load.

Datatables[edit]

Datatables are an EmueraEE addition, which allows you to create object-based tables and use those instead of arrays.


To initialize a table:[edit]

  • Define the table using DT_CREATE
  • Add columns using DT_COLUMN_ADD. There are multiple types of columns you can define.
    • Integers (int8, int16, int32, int64)
    • Strings (don't define anything)
  • Add the table name to VarExt.CSV if you want to have it saved to the save file

Example:

#DIMS DYNAMIC nTableName

nTableName '= @"combatMagic"
DT_CREATE nTableName
DT_COLUMN_ADD nTableName, "chara", "int16"
DT_COLUMN_ADD nTableName, "spellPage", "int32"
DT_COLUMN_ADD nTableName, "spell", "int32"
DT_COLUMN_ADD nTableName, "enchantment", "int16"

Adding rows and cells[edit]

Use `DT_ROW_ADD` to create new entries in a datatable. Keep in mind that all cells must follow the defined format rules (ie: no strings in an integer row, no numbers over 255 in an int8 row, no decimals, ever, etc).

{
DT_ROW_ADD "combatMagic",
"chara", ARG,
"spellPage", PAGE,
"spell", RESULT
} 


Character stats[edit]

A character is made up of multiple stats and data types, with most of them being in comma separated value sheets (CSVs).

There are many main data types for a character

  • ABL
  • BASE
  • CFLAG
  • CVAR
  • CSTR
  • EX
  • EXP
  • JUEL
  • MARK
  • SOURCE
  • STAIN
  • PALAM
  • TALENT
  • TCVAR
  • TEQUIP
  • DIM
    • CHARADATA
      • Charadata DIMs are weird and are going to be discussed in the variables section
    • CONST
    • DYNAMIC
    • REF
    • GLOBAL
    • SAVEDATA
  • TempVar

ABL (Abilities)[edit]

ABLs are the character's abilities and can range from mundane stuff like speech, to a complicated scale like pee holding or alcohol resistance. They're found in CSV/ABL.csv

To grab:

ABL:CharaID:ID
;they can also be grabbed with the internal name
ABL:CharaID:指

BASE[edit]

BASE are the character's stats/needs like their health, stamina, hunger, etc. Bases also have a character set max, known as a MAXBASE

They're found in CSV/BASE.csv

To grab:

BASE:CharaID:ID
;they can also be grabbed with the internal name
BASE:CharaID:気力

UPBASE[edit]

UPBASE increases the character's given base value.

DOWNBASE[edit]

DOWNBASE decreases the character's given base value. Often used after actions to be able to show how much BASE was taken away.

CFLAG (Character Flags)[edit]

Flags that can be set in a per-character basis

They're found in CSV/CFLAG.csv

To grab:

CFLAG:CharaID:ID
;they can also be grabbed with the internal name
CFLAG:CharaID:DiapeCharges

CSTR (Character Strings)[edit]

CSTRs are character separated strings, often used for keeping history when important things happen like losing a character's virginity.

They're found in CSV/CSTR.csv

To grab:

CSTR:CharaID:ID
;they can also be grabbed with the internal name
CSTR:CharaID:LostVirginStr

EQUIP[edit]

Equipment the 2hu currently has. Usually used for clothing

They're found in CSV/TEQUIP.csv

To grab:

EQUIP:CharaID:ID
;they can also be grabbed with the internal name
EQUIP:CharaID:Weapon

EX[edit]

EX values are used to determine how much of a certain event has happened during sex in a day.

NOWEX is also used as a way to track what's about to happen at the end of the command

They're found in CSV/EX.csv

To grab:

EX:CharaID:ID
;they can also be grabbed with the internal name
EX:CharaID:VOrgasm

NOWEX:CharaID:ID

EXP (Experience)[edit]

EXP corresponds to certain things happening and is used to be checked to see if an ability can be leveled up. Often one action means one EXP for the related attributes

They're found in CSV/EXP.csv

To grab:

EXP:CharaID:ID
;they can also be grabbed with the internal name
EXP:CharaID:VExp

JUEL (Gems)[edit]

JUELs are often combined with PALAM and EXP as a form of experience also used for commands and leveling up.

They're found in CSV/CFLAG.csv

To grab:

JUEL:CharaID:ID
;they can also be grabbed with the internal name
JUEL:CharaID:Sex

MARK[edit]

MARKs are used to signify important events like if she's lewd or hates you.

They're found in CSV/MARK.csv

To grab:

MARK:CharaID:ID
;they can also be grabbed with the internal name
MARK:CharaID:Hate

SOURCE[edit]

Used to increase PALAM values and show it increasing.

They're found in CSV/SOURCE.csv

To grab:

SOURCE:CharaID:ID
;they can also be grabbed with the internal name
SOURCE:CharaID:CPleas

STAIN[edit]

STAINs shows the dirtiness of the body part and if it has touched other parts.

Stains work on a bit based system

They're found in CSV/STAIN.csv

To grab:

 STAIN:CharaID:ID |= 16

PALAM (Parameters)[edit]

PALAMs are values that scale up with abilities and what commands you do. They're often used to track pleasure, lubrication, pain, etc.

They're found in CSV/PALAM.csv

To grab:

PALAM:CharaID:ID
;they can also be grabbed with the internal name
PALAN:CharaID:Pain

TALENT[edit]

Character traits and skills

They're found in CSV/TALENT.csv

To grab:

TALENT:CharaID:ID
;they can also be grabbed with the internal name
TALENT:CharaID:PeeHabit

TCVAR (Temporary Character Variables)[edit]

Used for per character temporary variables that are reset every day

They're found in CSV/TCVAR.csv

To grab:

TCVAR:CharaID:ID
;they can also be grabbed with the internal name
TCVAR:CharaID:UnconTimer

TEQUIP[edit]

Equipment the 2hu currently has

Will clear at the end of the day much like TCVARs

They're found in CSV/TEQUIP.csv

To grab:

TEQUIP:CharaID:ID
;they can also be grabbed with the internal name
TEQUIP:CharaID:VCombo

DIM DYNAMIC[edit]

DIM variables that are cleared when a function has been successfully executed. Use this if you have variables in a function that are not automatically cleared and don't want to use a VARSET to reset the variable at that start of the function.

DIM REF[edit]

DIM variables that uses a reference variable that's given as an argument for a function. They are bound to the limitations of the variable referenced, and any changes to a REF DIM affect the reference variable.

DIM CHARADATA[edit]

These use the power of DIM variables to make a variable which can be any type. The main advantage of this is that it does not take a CSV ID and will never result in merge conflicts, making it perfect for mods

To grab:

; Define on an ERH file
#DIM CHARADATA SAVEDATA PeopleFucked

;means there are 5 entries which can be called per character
#DIM CHARADATA SAVEDATA ExtraThings, 5

; To call in a ERB script
PeopleFucked:ARG:0



ExtraThings:ARG:0
ExtraThings:ARG:1
ExtraThings:ARG:2
ExtraThings:ARG:3
ExtraThings:ARG:4

DIM GLOBAL[edit]

These are flags that are GLOBAL and are not save-dependent.

To grab:

; Define on an ERH file
#DIM GLOBAL nCumMultiply

; To call in a ERB script
LOADGLOBAL

TW Specific Variables[edit]


Variables:
YearLength; 124 days in a year, 31 days in a month, 4 months
TARGET; the character you're currently targeting
CHARANUM; number of characters including you and duplicates.

Bases:
0,体力; STA, Stamina, remember to always subtract 500 since you faint at 500 and not 0
1,気力; ENE, Energy, how much energy the Touhou has. Hitting 0 means no more doing actions (you'll have to rest)
2,射精, CUM, Cum, how much pleasure needed before the Touhou ejaculates
3,母乳; MILK, how much milk is in the Touhou's breasts.
4,尿意; PEE, tracks how much pee is in the Touhou's bladder, only used in NAS.
5,勃起; EREC, Erection, max = erection
6,精力; VIG, Vigor, tracks how much you can cum
7,法力; MP, Magic Power, only used in NAS for it's magic system.
8,TSP; TSP, Time Stop Power, tracks how much long you can stop time for.

10,ムード; Mood
11,理性; Composure
12,怒り; Anger
13,仕事量; Work, Having more than 0 in this means the Touhou is working
14,深度; Sleepiness?, Not really sure
15,酒気; Drunkenness
16,潜伏率; Concealment, only used in sex during a secluded spot
17,Poo; Like PEE, but with solids. Only used in NAS
18,Hypno; For NAS' hypnosis system

20,身長; Heigh
21,体重; Weight
22,バスト; Breast Size
23,ウェスト; Waist Size
24,ヒップ; Hip Size

30,Blood; NAS only, made to track blood loss

TW Specific Functions[edit]


Pronouns:
HE_SHE(ARG); outputs "he" or "she" depending on the gender of the 2hu, put 1 in the second argument for capitalization
HIS_HER(ARG); Same but with "his" and "her"
HIM_HER(ARG); Same but with "him" and "her"
HES_SHES(ARG); Same but with "he's" and "she's"
HIMSELF_HERSELF(ARG); Same but with "himself" and "herself"

Number Functions:
ORDINAL(ARG); puts an ordinal after an number
DIGIT_GROUP(ARG); groups the digits for easier reading
NUM_COUNT(ARG); counts numbers
PLURALIZER(ARGS, ARG); pluralize the word if ARG is more than 1
ARTICLE(ARGS); a simple check for an article
 
Word Functions:
CAP_PROCESS(ARGS, ARG); 1 = lower, 2 = upper, 3 = capitalize first letter, 4 = random capitalizations, 5 captialize every word
CAPITALIZE(ARGS); capitalize first letter
SLUR(ARGS); simply continue last letter of the word
STUTTER(ARG); cause a stutter
SPLIT_G(ARGS); randomly picks one string out of a list.
FSYN(ARGS); randomly picks one synonym from a predefined word.

Character functions:
PRINT_MALE(ARGS, ARG); Print mutually exclusive terms depending on the condition per function
TNAME(ARG); Output's the character's title
HAS_PENIS(ARG); if characer has a penis
HAS_VAGINA(ARG); if character has a vag
IS_FEMALE(ARG);is character a female
IS_MALE(ARG); is character a male
IS_HERM(ARG);has penis or vagina
IS_FUTA(ARG);neodev version

Cheat functions:
HESOYAM(ARG); heal character (but doesn't give you 250,000 yen unfortunately)
FUCKME(); makes target extremely horny
CALMME(); makes target not angry and removes all hate marks
BEGONE(); moves target to gap space
WAKEUP(); makes the target wake up

HERMME()/FUTAME():


Other:
NAME_FROM_PLACE(ARG); output's the location's name
PRINT_DIALOGUE(ARGS); output's dialogue with linebreaks. Not often used, as using normal print functions is enough for most writers.
SET_KOJO_COLOR(ARG); set kojo color based off the character.
UNICODE(ARG); outputs a specific unicode character. 0x2665 is often used the most, printing out a heart.
UniversalRank(ARG); output's a non-H ability's level corresponding to the rank. (Intended as a compatibility function with NAS and other branches)
ASK_YN(); Yes or no input function
ASK_M(ARGS, ARG, ARGS:1, ARG); Multi-input function with conditionals.
FIRSTTIME(ARGS); sets a flag when this function is called, intended for first-time command exclusive text.

NAS Specific:
IsPadded(ARG, nTypeCheck = "", nPantsu = -1); does the character have a diaper or not
SoiledDiaper(ARG, ExcreteType, SoilBool, SoilThreshold); if the 2hu's underwear is soiled, SoilBool 0 is a simple bool, 1 = pecentage, 2 = absolute value
HostileAffinity(RECEIVING,ATTACKING); checks if the character has a hostile affinity with another. 1000 means fully hostile, 200 means very bad relations.

GROUPMATCH()[edit]

An IF statement which can compare a value and if the value equals to one of the values listed, then it returns 1.

SIF GROUPMATCH(LOCAL,3,6,129)
     RETURNF 1

Adding Dialogue[edit]

Adding original dialogue is often the most common mod that people want to do, but the barrier due to the EraBasic language is often too much.

Grabbing Template Files[edit]

Assuming that we are adding dialogue to a character without dialogue, like Chimata as an example, we will have to grab the template files that are in the game.

Go to eraTW\改造とかしてみたい人のためのあれこれ\口上関連\別人版用口上テンプレ (or 改造とかしてみたい人のためのあれこれ\口上関連\口上テンプレ\ or ERB\TRANSLATION\OMOGATARI\CHARA\Template) and grab the template files. Remember that these are encoded as UTF-8 without BOM!

The minimum you should grab:

  • M_KOJO_KX_イベント
    • イベント (Events) is for stuff like intro, flag setting, first kiss/confession from the character, after date dialogue, dialogue upon meeting, etc.
  • M_KOJO_KX_絶頂
    • 絶頂 (Climax) is for orgasm lines. Separated from general orgasm from 2hu, to reactions to you ejaculating depending on the spot your cum is landing. The thing about the general PALAMCNG function is that it can actually print lines at any times, it's just that this particular one reacts to orgasm flag only, so gotta be careful if you add new lines or try to combine them together.
  • M_KOJO_KX_コマンド
    • コマンド (Commands) is when you do a sex command to Chimata and other misc stuff, mostly related to femc (caressing/fucking you, etc), some minor consumables like lotion, aphrodisiac and ovulation drug, and a very cool unique portion - reaction after an action (PALAMCNG_C). the latter by default has reactions to defloration and cleaning blowjob, but it can be expanded to include literally anything, and it's a good place to write extra addendum and stuff (check reisen/seija for example). for older dialogues, this last part might be contained in the mark file instead.

These are optional but should be made if you want to complete a character

  • M_KOJO_KX_カウンター
    • カウンター (Counter) is for counter actions that girls initiate on you, aka reverse actions. contains both innocent cuddling and stuff like straddling you down.
  • M_KOJO_KX_セクハラコマンド
  • セクハラコマンド (Sexual Harassment Command) is for daily cuddling and touchy feely stuff (kiss, embrace, touch ass/boobie, flip skirt, etc). these actions are also available for you during reverse sex (counter mode), which some dialogues have some support for.
  • M_KOJO_KX_ハードなコマンド
    • ハードなコマンド (Hard Commands) is for hardcore SM, but it's mostly unused because most of these commands are commented out. At best you'll find deepthroat, titfuck, and urinate there. You'd think that spanking should be there, but it's in another file
  • M_KOJO_KX_愛撫系コマンド
    • 愛撫系コマンド (Caress Commands) is for all things related to caress commands during sex - caress, cunni, rimjob, kiss during sex (not to be confused with kiss outside sex), etc. Also contains pillow talk, do nothing and seduce me commands.
  • M_KOJO_KX_依頼
    • 依頼 (Requests) is for requests. only a handful of dialogues have this at all because of how clunky the template is (they included everything needlessly). Check Seija/Reimu on how I made it simpler and easier for writing.
  • M_KOJO_KX_育児イベント
    • 育児イベント (Childcare Events) is for child-related. Mostly tracks children-related growth stages and some events, not a lot of dialogues use it because the template for it is confusing and is barebones. Those that do make use of it modify it considerably. Clownpiece, Hatate, and especially Tewi have lots of childcare content.
  • M_KOJO_KX_加虐系コマンド
    • 加虐系コマンド (Abusive Commands) is for the rest of SM commands, spanking is here, some equipment like rope, but again most of those commands are disabled.
  • M_KOJO_KX_印取得
    • 印取得 (Mark Acquisition) is for marks, for stuff like acquiring hate mark and etc. Some dialogue can be weird about it and don't have this file, the function (MARKCNG) is instead contained in either イベン ト or コマンド. PALAMCNG_C can be here sometimes.
  • M_KOJO_KX_自慰系(あなた)コマンド
    • 自慰系(あなた)コマンド (Masturbation (You) Commands) is not used at all. It was supposed to be reactions to PC's masturbation mode that was never implemented because it was too buggy, and no one got it done, but the files still remain to this day. The concept was that you could delude yourself into imagining having sex with any 2hu, so you summon a copy of them into your room, do your thing, and then snap out of it - all of the experience you just got with them is reset afterwards.
  • M_KOJO_KX_性交系コマンド
    • 性交系コマンド (Intercourse Commands) - you know it, you love it, it's for sex stuff, all related to penetrations. Note that missionary 正常位 and doggy 後背位 have two sections - for standing (TFLAG:193, 立位) and regular. Also g-spot tease and cervix tease here are weird and don't do anything I think? The dialogue for those is in another file.
  • M_KOJO_KX_弾幕勝負
    • 弾幕勝負 (Danmaku Match) is for danmaku duel, it's simple but can be made elaborate (see daiyousei, seija, reisen).
  • M_KOJO_KX_道具系コマンド
    • 道具系コマンド (Tool Commands) is for sex toys and condom use. Onahole there is for putting it on 2hu and doesn't refer to onaholejob (which is a modded service command only available in Neodev).
  • M_KOJO_KX_日記
    • 日記 (Diary) is for a character's diary. Only a handful of characters use it. Eiki and Seija are good references if you want to implement diary lines of your own.
  • M_KOJO_KX_日常系コマンド
    • 日常系コマンド (Everyday Commands) is for the second biggest file usually, contains everything related to daily actions (from 300 to 600+ number-wise).
  • M_KOJO_KX_派生コマンド
    • 派生コマンド (Derived Commands) is for these derived commands, stuff like 69 (you using cunni and 2hu going blowjob for example), g-spot tease and cervix tease are here. Has also limited support for "double" actions, as in double blowjob from two different 2hus, etc.
  • M_KOJO_KX_奉仕系コマンド
    • 奉仕系コマンド (Service Commands) is for service-related, handjobs, blowjobs, etc.

Nurse, Arm, Spurt Exclusive[edit]

You will only find this if you look at the templates in ERB\TRANSLATION\OMOGATARI\CHARA

  • M_KOJO_KX_NAS_EVENT (General Events)
    • NAS Specific commands. Contains stuff for NAS specific general events such as character creation, death, death reactions, gaining reputations, arousal, etc.
  • M_KOJO_KX_NAS_DAILY (Daily Commands)
    • NAS Specific commands. Contains stuff for NAS exclusive commands such as doctoring, religion conversion, the shock wand, and kicking them out.
  • M_KOJO_KX_NAS_SEX (Sex Commands)
    • Contains commands like facesitting, e-stim, and pantyjob.
  • M_KOJO_KX_NAS_HARD (Hard Commands)
    • NAS Specific hard sex commands including the revamped urinate and defecate commands, bladder torture, and urethral commands.
  • M_KOJO_KX_NAS_EVENT_OMO (Pee Events)
    • The OMO file contains events related to the pee system such as diaper checking, bladder and bowel desperation, and relieving oneself on the toilet or outside.

See Contributing/Modding TW/Bare Minimum Dialogue for a good set of bare minimum content that your dialogue should have

Finding the character[edit]

Then go to ERB/ 口上・メッセージ関連/個人口上/

and find your character in Japanese (use TouhouWiki.net or THB). When you find it, paste in the files and rename all files with X to your character ID (Chimata is 141, so replace it with K141).

Setting your dialogue as an alt[edit]

If you're going to make a dialogue for a character who already has one, you'll need to make some changes to your files first.

To start, go to your events file and change the @M_KOJO_KX function based on what slot your alt dialogue is in. (Ex. if you're adding a second dialogue to Rumia, you would change that function to @M_KOJO_K12_1). Next, you'll need to set RESULTS to an internal identifier for that dialogue's functions and RESULTS:1 to the dialogue's name in the selection list. (Ex. /egg/ Sakuya uses RESULTS = _ENG01 and RESULTS:1 = 8Chan /egg/). Finally, you'll need to rename all your functions to use the internal identifier after the KOJO part of the function name.. (Ex. for the encounter function, JP Sakuya uses @M_KOJO_ENCOUNTER_K15, Young Girl Sakuya uses @M_KOJO_少女長_ENCOUNTER_K15, and /egg/ Sakuya uses @M_KOJO_ENG01_ENCOUNTER_K15.)

Making Dialogue[edit]

Then use the PRINT commands to make dialogue that corresponds to the event (ie: Encounter is when you first meet her, COM_KX_300 is when you have a convo, 射精 is when the 2hu ejaculates). Parsee's dialogue has English comments for most of the functions in her dialogue, so check her files if you aren't sure what something does.

Working with CFLAGs[edit]

CFLAGs are variables associated with a dialogue. They can be used for counters, quest chains, and many other things.

To add CFLAGs to your dialogue, create an ERH file in the same folder as your other dialogue files. I don't think it matters what you call it, but you might as well just go with K[character ID]C_[CHARACTERNAME]DIM.ERH. (ex. for Mugetsu, you'd use K116C_MUGETSUDIM.ERH.)

Now let's say you want a counter that counts how many times Mugetsu has drank alcohol. Go into your new ERH file and add a line like this:

#DIM CONST K116EN_DRINKING_EXP                                           =    1001
 

Then increment it whenever Mugetsu drinks alcohol (Serve Alcohol, drinking at a party, etc.):

CFLAG:116:K116EN_DRINKING_EXP ++

Make sure you always have the identifier (in this case, the :116: part) when doing CFLAG checks, or else you'll be checking/modifying the variable ID instead of the variable's value.

Working with VER and FLAG_VER[edit]

Some characters, like Marisa, Suwako, Nue, and Parsee, have VER and FLAG_VER variables defined in their DIM files. VER is set to the version of the dialogue (1391/1.39.1, 001/0.0.1, 130/1.3.0), and FLAG_VER is the variable that tracks what the current dialogue version is. In your update code, you'll want to set FLAG_VER to the value of VER (ex. "CFLAG:[[パルスィ]]:K60EN_FLAG_VER = CFLAG:[[パルスィ]]:K60EN_VER") If you want to do special things on update (like Parsee's bugfixes), you'll want to check the value of FLAG_VER, not VER (ex. "IF CFLAG:[[パルスィ]]:K60EN_FLAG_VER < 138").

Adding New Abilities[edit]

Adding a new ability is pretty complicated, especially since we are using CHARADATA DIMs instead of CSVs

In our example, we'll be adding an alcohol and drug resistance scale.

The DIM way[edit]

First we'll have to define the variables that we will use for our ability.

Make a new ERH file (or use an existing file if you already created some stuff), and add this

#DIM CHARADATA SAVEDATA AlcoholResistance
#DIM CHARADATA SAVEDATA DrinkingExp

AlcoholResistance is our ability, and DrinkingExp is our experience. These will be applied to each character and saved to the save file

Then we'll have to add the ability to level up and down this stat, as well as state the amount of experience needed to level up this ability.

After making the ability, it's time to make it show up on the user interface. Since this is a scale attribute, we will also have to make a new grading system for it.

Most of our work is based off modifying TRANSLATION/List.erb

Our first modification is to edit PRINT_SPECIFIC_HTML to show our new ability we just added.

#DIM CONST DISP_ID =
0, 9, 43, 0, 50, 15, 31,
1, 10, 41, 1, 54, 16, 32,
2, 11, 42, 2, 55, 17, 33,
3, 12, 40, 3, 52, 18, 34,
4, 13, 44, 4, 51, 0, 35,
5, 14, 45, 0, 53, 0, 30,
0, 0, 46, 0, 0, 0, 0,
0, 0, 47, 0, 0, 0, 0,
0, 0, 48, 0, 0, 0, 23,
0, 0, 49, 0, 0, 0, 0,
}
#DIM C_ID
{
#DIMS CONST DISP_NAME =
" PAIN", " Intimacy", "Knowledge", "CSens", " Hand", " Maso", " Semen",
" PLSR", "Obedience", " Speech", "VSens", "Vagina", " Sado", " Homo♀",
" LEWD", " Desire", " Combat", "ASens", " Anus", "Homo♀", " Homo♂",
" HATE", "Technique", " Cleaning", "BSens", " Chest", "Homo♂", " Creampie",
"Old HATE", "Servitude", " Cooking", "MSens", "Tongue", "", " A Creampie",
" RAPE", " Exposure", " Music", "", " Waist", "", "Masturbation",
"", "", " Logging", "", "", "", "",
"", "", " Fishing", "", "", "", "",
"", "", " Foraging", "", "", "", "Drug",
"", "", " Mixing", "", "", "", "",
}

This makes it show up on the gui but we still have to sort out the grading system

Since we are making an attribute that is a scale we will have to make a new grading system for it.

ELSEIF ARG == 54
    OUTPUT '= @"<nonbutton title='%ABILITY_DESCRIPTION_HTML(C_ID,ARG)%'>"
    OUTPUT += @"%DISP_NAME:ARG, 10%:"
    OUTPUT += PRINT_RANK_HTML(AlcoholResistance:C_ID:0, "MAX_11_SCALE")
    OUTPUT += @" {ABL:C_ID:(DISP_ID:ARG), 3}"
    OUTPUT += @"</nonbutton>"

This makes it show the level of alcohol resistance

In PRINT_ALPHABET_HTML, we will have to define the ranks for our new scale. Make sure to do the same thing in PRING_ALPHABET too in COMMON.erb

#DIMS CONST STR_RANK11, 11 = "Ex", "SS", " S", " A", " B", " C", " D", " E", " F", " G", " H"

;this makes C the average and turns it grey
{
#DIMS CONST C_RANK11, 11 =
"C_P_PURPLE", "C_WHITE", "C_RED", "C_ORANGE", "C_YELLOW",
"C_GRAY", "C_YELLOW", "C_ORANGE", "C_RED", "C_WHITE", "C_PINK"
}

Define a new entry for 11 ranks

SELECTCASE RANK_NUM
    CASE 11
        RETURNF COLOR_PRINT_HTML(STR_RANK11:RANK, C_RANK11:RANK, 2)

Under CALC_RANK_FUNCTION and CALC_RANK (in COMMON.erb) we can define what our numbers scale to. In our case we will be doing a -5 to 5 system

CASE "MAX_11_SCALE"
;for endurance scales
    SELECTCASE VAR_VALUE
        CASE IS >= 5
            RANK = 0
            ;upper limit
        CASE IS >= 4
            RANK = 1
        CASE IS >= 3
            RANK = 2
        CASE IS >= 2
            RANK = 3
        CASE IS >= 1
            RANK = 4
        CASE IS >= 0
            RANK = 5
            ; you start at 0
        CASE IS >= -1
            RANK = 6
        CASE IS >= -2
            RANK = 7
        CASE IS >= -3
            RANK = 8
        CASE IS >= -4
            RANK = 9
        CASEELSE
            RANK = 10
            ;lower limit
        ENDSELECT
        

Define an entry in CALC_RANK_NUM_FUNCTION

CASE "MAX_11_SCALE" ;needed for endurance abilities RANK_NUM = 11

Make a description to show criteria for level up

CASE 54; Alcohol Resistance
    LOCALS '= "How strong drugs affect you.\n"
    LOCALS += "Progress towards next stage (addict):\n"
    IF AlcoholResistance:C_ID:0 >= 5
        LOCALS += @" MAXED!\n"
    ELSE
        LOCALS += "Experience:\n"
        LOCALS += @" Drug: %ABILITY_FORMAT_HTML(OrgasmDenyExp:C_ID:0, EXP_DEMAND_22(0,90,C_ID,1))%\n"
    ENDIF
    LOCALS += "Progress towards next stage (nondrinker):\n"
    IF AlcoholResistance:C_ID:0 <= -5
        LOCALS += @" MAXED!"
    ELSE
        LOCALS += "Experience:\n"
        LOCALS += @" Drug: %ABILITY_FORMAT_HTML(DrinkingExp:C_ID:0, -EXP_DEMAND_22(0,90,C_ID))%"
    ENDIF

Go to ERB/ステータス計算関/ABL/ABL_UP_DATA.ERB and add the id of the exp you want to occupy under EXP_DEMAND.

In this case, we will be taking ID 22.

ELSEIF ARG == 22
; call exp demand for alcohol resistance
    RETURNF EXP_DEMAND_22(ARG:1,ARG:2,ARG:3)

Once we did that, we will have to make the function that we wanted to call

;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
;Alcohol and Drug Resistance
;For these values they determine the threshold
;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
@EXP_DEMAND_22(ARG,ARG:1,ARG:2,ARG:3=0,ARG:4=0)
#FUNCTION
VARSET LOCAL
;reset local since this is our grab variable
IF !ARG:4
    LOCAL = AlcoholResistance:(ARG:2):0+(ARG:3)
;set the grab variable to the 2hu's alcohol resist
ELSE
    LOCAL = ARG:4
ENDIF
; grab the exp needed based off the level
SELECTCASE LOCAL
    CASE -5
        LOCAL = -2000
    CASE -4
        LOCAL = -1000
    CASE -3
        LOCAL = -500
    CASE -2
        LOCAL = -250
    CASE -1
        LOCAL = -100
    CASE 0
        LOCAL = 0
    CASE 1
        LOCAL = 100
    CASE 2
        LOCAL = 250
    CASE 3
        LOCAL = 500
    CASE 4
        LOCAL = 1000
    CASE 5
        LOCAL = 2000
ENDSELECT

RETURNF LOCAL

This will give the exp needed to level up or down the ability.

Next up is a way of giving experience to this stat. Since our example is alcohol resistance, it would be a good call to increase it by drinking alcohol

In COM332, we can add a line below line 181 which gives alcohol resistance if the 2hu drinks alcohol

SOURCE:歓楽 = SOURCE:歓楽 * 味補正 / 10
SOURCE:征服 = SOURCE:征服 * 味補正 / 10
SOURCE:受動 = SOURCE:受動 * 味補正 / 10
;custom code
DrinkingExp:TARGET:0 += 味補正

Finally is a way to track if a character has enough exp to level up this stat. The function for this is found in

;Alcohol resistance
    LOCAL:90 = AlcoholResistance:ARG:0
    IF DrinkingExp:ARG:0 >= EXP_DEMAND_22(0,90,ARG,1) && AlcoholResistance:ARG:0 < 5
        AlcoholResistance:ARG:0 ++
        IF ARG == 0
            PRINTFORMW %PARSE("Your")% body is now more resiliant to drugs.
        ELSE
            PRINTFORMW %CALLNAME:ARG%'s body is now more resiliant to drugs.
        ENDIF
    ELSEIF (DrinkingExp:ARG:0 < (EXP_DEMAND_22(0,90,ARG,-1)) || (DrinkingExp:ARG:0 < EXP_DEMAND_22(0,90,ARG) && DrinkingExp:ARG:0 > 0)) && AlcoholResistance:ARG:0 > -5
    AlcoholResistance:ARG:0 --
    IF ARG == 0
        PRINTFORMW %PARSE("Your")% body is now less resiliant to drugs.
    ELSE
        PRINTFORMW %CALLNAME:ARG%'s body is now less resiliant to drugs.
    ENDIF
ENDIF

You can add additional talents on level up like I've did on my orgasm denial scale but you don't have to

Adding Items[edit]

Adding new items is easy, but it requires editing CSVs, adding the entry into ITEMDATA.erb, and applying its effects in Add_Item.erb

In our example, we will be making a candy which increases V and V stretch Exp by 100, takes our virginity, and increase stamina by 1000

First, we'll have to go to Item.csv and add our item and set its ID

 330,UselessCandy,3000

This makes an item with an ID of 330 which costs 500 yen.

Then we'll have to go to ERB/Translation/STR.erb and go to ITEMNAME_TR. Below that function, we can insert our translated item name.

CASE 70
    ;translated name which corresponds to our item id
    LOCALS = Violet Candy

We will also have to add a description to the item in ERB/アイテム解説.erb under ITEM_EXPLANATION to tell the player what it does.

CASE 330
    RETURNF "Drug that instantly removes【Virgin】from someone and stretches their holes. Immediate effect use item."

Once we added the item ID and its name, we'll have to add it to SHOP関連/ITEMDATA.erb to make it a buyable item and to categorize it correctly

CASE "UselessCandy"
    SELECTCASE ARGS
        CASE "SALES"
            ;how many you can buy
            RETURN 99
        CASE "購入"
            ;behavior when purchasing
            CALL ITEM_MATOMEGAI(ARG, ARG:1)
        CASE "TYPE:消耗品", "SHOP:通信販売"
            ;item flags
            RETURN 1
    ENDSELECT

This categorizes it as a consumable that is buyable in mail order.

Adding effects to items[edit]

Finally, we get to applying the item's effects. Go to TRANSLATION/Addition/Add_Item.erb and make it available to use by putting it under Add_UseableItem

CASE 330
    RETURN 2

add your item's effects under Add_UseItem

CASE 330
    PRINTFORMW You pull out a large jawbreaker, put it in your mouth, and start sucking on it.
    PRINTFORMW It tastes like strawberry.
    PRINTFORML While you are enjoying your candy, a portal appears underneath you.
    PRINTFORMW A foriegn object shifts your %CLOTHES_TR(PANTSNAME(EQUIP:ARG:下半身下着2, ARG))% and inserts it in your \@ HAS_VAGINA(MASTER) ? %FSYN("vagina")+" and"%#\@ %FSYN("anus")%...
    IF TALENT:MASTER:処女
        ; if player has a vag and is a virgin
        SETCOLOR 247,171,166
        PRINTFORMW 【Virginity Loss】
        CALL SET_HISTORY_LOST_V(MASTER, 26, "ペニス",)
        RESETCOLOR
        TALENT:MASTER:処女 = -1
        ; take master's virginity by yukari's tentacles
        PRINTFORMW You feel an unbearable pain in your %FSYN("vagina")%, getting violated like it's nothing.
    ENDIF
    IF CSTR:MASTER:アナル処女喪失履歴 == ""
        ; if player is a anal virgin
        SETCOLOR 247,171,166
        PRINTFORMW 【Anal Virginity Loss】
        CALL SET_HISTORY_LOST_A(MASTER, 26, "ペニス",)
        RESETCOLOR
        ; take master's virginity by yukari's tentacles
        PRINTFORMW Your asshole bleeds profusely from the sudden insertion.
    ENDIF
    PRINTFORMW You try to scream, but the candy has gagged your mouth shut...
    PRITNFORMW You look down and it seems to be a wide tenticle that's fucking you.
    PRINTFORMW You attempt to resist the tentacles violating you, but it doesn't budge.
    PRINTFORNW The relentless sensation is too much to endure as you fall on your ass...
    PRINTFORMW You surrender in pleasure as you cum over and over...
    EXP:MASTER:異常経験 += 30
    IF HAS_VAGINA(MASTER)
        EXP:MASTER:V経験 += 100
        EXP:MASTER:V拡張経験 += 100
        EXP:MASTER:絶頂経験 += 15
        EXP:MASTER:V絶頂経験 += 15
    ENDIF
    PRINTFORNW This repeats for hours...
    PRINTFORMW The tenticles never stops fucking you, despite you fainting...
    CFLAG:MASTER:徹夜 = 1
    CFLAG:MASTER:ヤラせちゃった = 1
    RETURN 2
    ;give V experience, climax, and rape flag and end day.

Adding new commands[edit]

Adding a new command is a bit complicated and can get overboard very quickly as you'll have to add them to the user interface and make a message

For this example, we'll be making a command that kicks out the selected 2hu from the room we are in.

First off, we have to add our command in CSV/Train.csv to register it as a usable command.

 489,KickOut

Once we've done that, we can add the command to the user interface

First we'll have to add the generic name to the command in TRANSLATION/STR.erb

CASE 489
    LOCALS = Kick Out

Once we have added the generic name of the command, we can now add the name that will be shown in the actual user interface in ERB/コマンド関連/USERCOM_コマンド表示処理.ERB under the SHOW_USERCOM function

ELSEIF LOCAL == 489
    PRINTFORMC Kick Out %CALLNAME:TARGET%[{LOCAL,3}]

This will tell the name of the character we are about to kick out of our room.

The final steps involve making our command. Make a new ERB file anywhere in the ERB folder (but you should make your own folder if you are adding new commands and such). Name it something like "COMF{ID} Command Name" ("COMF489 Kick Out" in our case)

Open the new ERB file we just created. First, we make the function that give the command it's effects

@COM489
CFLAG:TARGET:好感度 -= (50 - ABL:TARGET:親密 * 2)
CFLAG:TARGET:信頼度 -= (50 - ABL:TARGET:親密 * 2)
;reduce favor and reliability
SOURCE:TARGET:反感 += 300
BASE:TARGET:怒り += (5500 - ABL:TARGET:親密 * 100)
; make 2hu mad
CFLAG:TARGET:現在位置 = KICKOUT()
; move the 2hu to a different room

;we need to increase time by at least something or else we don't get the message.
TIME += 1
RETURN 1

After that, give the player a description of what they do to do that action.

@MESSAGE_COM489
PRINTFORMDW You kick %CALLNAME:TARGET% out of %STR_TR(CFLAG:MASTER:現在位置+8000)%
RETURN 1

Finally are the conditions that restrict the use of the command

@COM_ABLE489
; Do not allow during ufufu or time stop
SIF FLAG:70 == 1
    RETURN 0
SIF CFLAG:うふふ != 0
    RETURN 0
SIF !TFLAG:100
    RETURN 0
SIF CFLAG:睡眠
    RETURN 0
SIF TARGET == MASTER ; doesn't make sense to kick yourself out
    RETURN 0
RETURN 1

Adding New Character-Specific Commands (command 443)[edit]

First, you'll want to go to your character's data file. They're located in `\ERB\キャラデータ\Chara_data_[character ID]_[character's Japanese CALLNAME]`. Ex: Suika's file is `Chara_data_10_萃香.ERB`, Parsee's file is `Chara_data_60_パルスィ.ERB`, and Shinki's file is `Chara_data_102_神綺.ERB`.

Next, include a line like this somewhere in the file:

CASE "固有コマンド"
    CALLF MAKE_STR(V_NAME, "[command name]")
CASE "固有コマンド実行可能"
    CALLF MAKE_INT(V_NAME, !WORKING(60)

Most characters have it under `CASE "普段着:その他1"` or `CASE "普段着:その他 2`".

Finally, add a function for your command called `@UNIQUE_COM_[command name]`. You can define it anywhere, but most EN original custom commands are in their own files, named `Add_[CommandName].ERB`, and stored in `ERB\TRANSLATION\Addition`. Ex. Parsee's custom command is in Add_HashihimeServices.ERB, and Hina's custom command is in Add_Misfortune.ERB.

Adding Underwear[edit]

Underwear isn't something you need to add more of unless you want to make unique underwear or went full AB mode and decide to add diapes to gensokyo (Pops).

Underwear can be added by using the code as a template. It will automatically add them to the underwear array where all 2hus can wear

;ID is your underwear ID
;the english O_DATA entries are for Pops's branch only

@EXIST_下半身下着_ずらし可能ID
#LOCALSIZE 1
#LOCALSSIZE 1

@下半身下着_ずらし可能ID(ARG, O_DATA, V_NAME)
#FUNCTION
#LOCALSIZE 1
#LOCALSSIZE 1
#DIMS O_DATA
#DIMS V_NAME
SELECTCASE O_DATA
    CASE "名前"
        ;name
        CALLF MAKE_STR(V_NAME, "diaper")
    CASE "描写"
        ;description variable
        ;the real description is in MISC.ERB(?)
        CALLF MAKE_STR(V_NAME, "wtf is this used for")
    CASE "透ける(前)"
        ;Transparency. This is the opposite so 1 means you can't see
        CALLF MAKE_INT(V_NAME, 1)
    CASE "透ける(後)"
        ;Transparency. This is the opposite so 1 means you can't see
        CALLF MAKE_INT(V_NAME, 1)
    CASE "はける"
        ;requirements to have the 2hu wear it
        IF !nOmutsu
        ;the diaper flag
            CALLF MAKE_INT(V_NAME, 0)
        ELSEIF PeeHold:ARG:0 <= -2 || PooHold:ARG:0 <= -2 || TALENT:ARG:幼児/幼児退行 || GETBIT(TALENT:ARG:OmoGuardian, 2) || TALENT:ARG:BladderSize == 2
            ;needs to have continence issues or be a AB (infant regression) or DL (padded legend)
            CALLF MAKE_INT(V_NAME, 1)
        ENDIF
    CASE "着せ替え可能"
        ;can change into it after having their panties/diaper pilfered
        CALLF MAKE_INT(V_NAME, 1)
    CASE "関連下着"
        ;matching upperwear
        CALLF MAKE_INT(V_NAME, CLOTHES_ID("上半身下着1", "Tシャツ"))
    CASE "Priority"
        ;gives a priority (re: second chance) roll that it'll be picked.
        ;from 0 to 100. 100 means it WILL be picked if the game rolls on it and fails the RNG check for other panties.
        CALLF MAKE_INT(V_NAME, 100)
    CASE "男性下着"
        ;can men wear it (Neodev version)
        CALLF MAKE_INT(V_NAME, 1)
    CASE "Unisex"
        ;can men wear it
        CALLF MAKE_INT(V_NAME, 1)
    CASE "Panties Type"
    [SKIPSTART]
    Types:
    ・Underwear
    ・Open-Crotch
    ・Pull-Up
    ・Diaper
    ・Naked/Bare Skin
    ・
    There are also absorbency levels for diapers that go from Light (Light Diaper) -> Normal (Diaper) -> Heavy (Heavy Diaper) -> Extreme (Extreme Diaper)
    Catheters and incontinence/menstrual/diaper booster pads are handled with CFLAGs
    Use IsPadded(ARG) to find out if the 2hu has a diaper or a pad.
    [SKIPEND]
    CALLF MAKE_STR(V_NAME, "Diaper")
        CASE "Pee Capacity"
        ;how much piss it can hold if pee accidents are enabled
        ;if the 2hu has an accident without being padded they get dirty PALAMs (bad). If you're the one that has an accident you get the 「Not Potty Trained」 reputation
        CALLF MAKE_INT(V_NAME, 1750)
    CASE "Poo Capacity"
        ;how much poop it can contain if messy accidents are enabled
        CALLF MAKE_INT(V_NAME, 1000)
    CASE "Armor"
        ;how much penetration it can stop
        CALLF MAKE_INT(V_NAME, 2)
    CASE "Armor Health"
        ;how much damage can the armor take before losing efficiency or breaking
        CALLF MAKE_INT(V_NAME, 650)
    CASE "Armor Coverage"
        ;what parts the armor covers, use / to separate body part IDs
        CALLF MAKE_STR(V_NAME, "61/53")
    CASE "コレクション解禁条件"
        ;unlock requirement variable
        ;the real description is in MISC.ERB(?)
        CALLF MAKE_STR(V_NAME, "Req: Potty Training -2")
    CASE "コレクション表示可能"
        ;condition expression needed to unlock. Often this is the same conditions as having the Touhou to equip it.
        CALLF MAKE_INT(V_NAME, 1)
ENDSELECT


Adding Clothing[edit]

Other clothing can also be added to TW. Just that in vanilla TW, it also has to be in a clothing set to be wearable.

Here is a list of all clothing slots that are available

	(1) アクセサリ		=	アクセサリ 		=	Decoration
	(2) 帽子 		=	頭装備 			=	Head
	(3) 靴			=	靴			=	Socks 
	(4) 靴下		=	靴下			=	Shoes

	(5) 下半身下着1		=	下半身下着_ずらし不可	=	Underwear(top)		(For bras that are worn by 2hus and can't be shifted)
	(6) 下半身下着2		=	下半身下着_ずらし可能 	=	Underwear(top)		(For bras that can be shifted)

	(7) 上半身下着1		= 	上半身下着_はだけ不可	=	Underwear(bot)		(Underwear on-top of underwear. Cannot be taken)
	(8) 上半身下着2		=	上半身下着_はだけ可能 	=	Underwear(bot)		(Underwear that can be taken. Includes panties, briefs, trunks, thongs, pull-up diapers, and taped diapers)

	(9) レオタード		=	レオタード 		=	Full-body Underwear	(Usually reserved for leotards and swimsuits)
	(10) ボディースーツ	=	ボディースーツ		=	Body Suit

	(11) ズボン		=	ズボン			= 	Pants
	(12) 下半身上着		=	下半身上着		=	Undergarment 		(Unused)

	(13) ワンピース		=	ワンピース		=	Full-body		(One-pieces)
	(14) 着物		=	着物			=	Kimono

	(15) スカート		=	スカート			=	Skirt

	(16) 上半身上着2	= 	上半身上着_はだけ可能	=	Shirt			(Shirts)
	(17) 上半身上着1	=	上半身上着_はだけ不可 	= 	Outer Garment		(Jackets, sailor unforms, shrine maiden clothes, etc)

	(18) 外衣		=	外衣			=	Upper Garment		(Capes, jackets, and armor vests)

	(19) その他1		=	その他衣装		=	Accessory
	(20) その他2		=	その他衣装		=	Accessory
	(21) その他3		=	その他衣装 		=	Accessory

	(22) 腕部装束		=	腕部装束 		=	Arms
	(23) Back		=	Back			=	Back
	(24) Weapon		=	Weapon			=	Weapon
 
;ID is your clothing ID
;ClothingType_ID (ie: 外衣_35)

@EXIST_スカート32
#LOCALSIZE 1
#LOCALSSIZE 1

@スカート32(ARG, O_DATA, V_NAME)
#FUNCTION
#LOCALSIZE 1
#LOCALSSIZE 1
#DIMS O_DATA
#DIMS V_NAME
SELECTCASE O_DATA
CASE "名前"
	CALLF MAKE_STR(V_NAME, "naughty leather skirt")
CASE "FullDesc"
	LOCALS '= @"A short skirt, but made with leather."
	CALLF MAKE_STR(V_NAME, LOCALS)
CASE "Shows Panties"
	[SKIPSTART]
	What types of panties will be shown though the skirt:
	Highest priority will be used.
	Leaking or messy underwear will always be shown in another line (smells).

	1: Completely concealed
	2: Extreme diapers and soaked Heavy diapers
	3: Heavy diapers and soaked Regular diapers.
	4: Diapers and drawers 
	5: All
	[SKIPEND]
	CALLF MAKE_INT(V_NAME, 1)
CASE "Armor"
	;how much penetration it can stop
	CALLF MAKE_INT(V_NAME, 3)
CASE "Armor Health"
        ;how much damage can the armor take before losing efficiency or breaking
	CALLF MAKE_INT(V_NAME, 1500)
CASE "Armor Coverage"
        ;what parts the armor covers, use / to separate body part IDs
	CALLF MAKE_STR(V_NAME, "60")
CASE "装備部位"
	CALLF MAKE_STR(V_NAME, "「スカート」")
CASE "Price"
	;Price in the clothing store.
	CALLF MAKE_INT(V_NAME, 4000)
ENDSELECT

Adding Weapons[edit]

Weapons can be added by using the code as a template. It will automatically add them to the weapon array where all 2hus can equip if Postal mode is on

;ID is your weapon ID

@EXIST_WeaponID
#LOCALSIZE 1
#LOCALSSIZE 1

;オブジェクト本体
@WeaponID(ARG, O_DATA, V_NAME)
#FUNCTION
#LOCALSIZE 1
#LOCALSSIZE 1
#DIMS O_DATA
#DIMS V_NAME
SELECTCASE O_DATA
    CASE "名前"
        CALLF MAKE_STR(V_NAME, "SIG MCX VIRTUS")
    CASE "FullName"
        CALLF MAKE_STR(V_NAME, "Sig Sauer MCX VIRTUS Assault Rifle")
    CASE "描写"
        CALLF MAKE_STR(V_NAME, "This is your weapon description")
    CASE "装備部位"
        CALLF MAKE_STR(V_NAME, "「Weapon」")
    CASE "Damage"
        ; default damage in a normal hit
        LOCAL = 962
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Accuracy"
        ; chance to HIT, 0-100%
        LOCAL = 50
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Burst"
        ;how many shots it fires per turn
        LOCAL = 5
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Pellets"
        ;bullets per shot
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Multi Hit"
        ;how many targets the weapon can hit per pellet
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Loudness"
        ;how far away a shot can be heard (in units)
        LOCAL = 7
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Mag Size"
        ;shots until you need to reload
        LOCAL = 30
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Range"
        ;how many units the weapon can fire
        LOCAL = 5
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Penetration"
        ;units that you can see it can penetrate
        ;also dictates what armor it can go through
        LOCAL = 2
    CALLF MAKE_INT(V_NAME, LOCAL)
        CASE "Grade"
        ;how many times you have to give 100 charisma to the kappa
        LOCAL = 5
    CALLF MAKE_INT(V_NAME, LOCAL)
        CASE "Price"
        ;price to DEVELOP
        LOCAL = 470000
    CALLF MAKE_INT(V_NAME, LOCAL)
        CASE "Prerequisite"
        ;weapon required to develop first
        LOCAL = 40
        CALLF MAKE_INT(V_NAME, LOCAL)
    ;These are attachment slots
    CASE "Grip Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Foregrip Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Reciever Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Magazine Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Barrel Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Tactical Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Sight Slot"
        ; 1 = pistol sights
        ; 2 = red dots and low magnification scopes
        ; 3 = high magnification scopes
        LOCAL = 3
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Stock Slot"
        LOCAL = 1
        CALLF MAKE_INT(V_NAME, LOCAL)
    CASE "Type"
        [SKIPSTART]
        Types:
        ・Melee
        ・Firearm
        ・Explosive
        ・Throwable
        [SKIPEND]
        CALLF MAKE_STR(V_NAME, "Firearm")
    CASE "Class"
        [SKIPSTART]
        Types:
        ・Pistol
        ・Rifle
        ・Shotgun
        ・Light Machine Gun
        ・Medium Machine Gun
        ・Heavy Machine Gun
        ・1H Blunt
        ・2H Blunt
        ・1H Blade
        ・2H Blade
        ・Spear
        [SKIPEND]
        CALLF MAKE_STR(V_NAME, "Rifle")
    CASE "Ammo"
        [SKIPSTART]
        Caliber in metric units
        [SKIPEND]
        CALLF MAKE_STR(V_NAME, "5.56x45mm")
    CASE "Fire Sound"
        CALLF MAKE_STR(V_NAME, "firearms/AT MR-92.wav")
    CASE "Tags"
        [SKIPSTART]
        Tags:
        ・civilian
        ・military
        ・medival
        ・world war
        ・modern
        ・spacer
        ・ultra
        ・archotech
        ・assault rifle
        ・machine gun
        ・sniper rifle
        ・anti-tank
        ・revolver
        ・autopistol
        ・carbine
        ・soviet
        ・western
        ・bow
        ・musket
        ・battle rifle
        ・3d printed
        ・explosive
        ・non lethal
        ・incendiary
        ・american
        ・german
        ・japanese
        ・chinese
        [SKIPEND]
        CALLF MAKE_STR(V_NAME, "military/western/modern/assault rifle")
ENDSELECT

Spell Cards[edit]

Spell cards are much like weapons, but spell cards are unique to each character. They can also do unique effects such as healing people, affecting accuracy, and many other things.

@EXIST_SpellCard12
#LOCALSIZE 1
#LOCALSSIZE 1

@SpellCard12(ARG, O_DATA, V_NAME)
#FUNCTION
#LOCALSIZE 1
#LOCALSSIZE 1
#DIMS O_DATA
#DIMS V_NAME
SELECTCASE ARG
CASE 1
	SELECTCASE O_DATA
	CASE "名前"
		CALLF MAKE_STR(V_NAME, @"「Innate Dream」")
	CASE "Description"
		CALLF MAKE_STR(V_NAME, @"A secret technique which is extreme in many ways. With Reimu's ability to float, she floats away from all sorts of things and cannot to be attacked. If it wasn't just for play (with time limit), no one could beat her using any method.")		
	CASE "ESP"
		CALLF MAKE_INT(V_NAME, 4000)
	CASE "Grade"
		CALLF MAKE_INT(V_NAME, 30)			
	CASE "Damage"
		CALLF MAKE_INT(V_NAME, 300)
	CASE "Accuracy"
	;	chance to HIT, 0-100%
		LOCAL = 12
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Burst"
		LOCAL = 150
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Pellets"
		LOCAL = 35
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Range"
		LOCAL = 10
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Penetration"
		LOCAL = 6
		CALLF MAKE_INT(V_NAME, LOCAL)	   	
	CASE "Multi Hit"
		LOCAL = 100
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Player Accuracy"
	;	chance to HIT, 0-100%
		LOCAL = 100
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Ally Accuracy"
	;	chance to HIT, 0-100%
		LOCAL = 100
		CALLF MAKE_INT(V_NAME, LOCAL)	
	CASE "Ally Dodge"
	;	chance to HIT, 0-100%
		LOCAL = 100
		CALLF MAKE_INT(V_NAME, LOCAL)		
	CASE "Hostile Accuracy"
	;	chance to HIT, 0-100%
		LOCAL = 0
		CALLF MAKE_INT(V_NAME, LOCAL)		
	CASE "Hostile Dodge"
	;	chance to HIT, 0-100%
		LOCAL = 0
		CALLF MAKE_INT(V_NAME, LOCAL)			
	CASE "Last Spell"
		LOCAL = 1
		CALLF MAKE_INT(V_NAME, LOCAL)			
	CASE "装備部位"
		CALLF MAKE_STR(V_NAME, "「SpellCard」")
	ENDSELECT
ENDSELECT

Adding New Characters[edit]

Adding characters requires a CSV entry, a CHARADATA ERB file, and a picture associated with them

This is a character's CSV entry (place in the CSV folder

;charcter ID
番号,145,

;character name
名前,Kotohime,
;character callname
呼び名,Kotohime,

;max stamina
基礎,体力,2500
;max energy
基礎,気力,2000

;don't touch
基礎,勃起,1500
;maybe touch if your 2hu has a dick
基礎,精力,10000

基礎,法力,1000
基礎,ムード,1500
基礎,理性,1000
基礎,怒り,1000
基礎,仕事量,0
基礎,深度,2000
基礎,酒気,1500

;max bladder and bowels are handled in PeeStuffs.ERB so don't set them here
;same with body part health and hypno things

;is virgin or not
素質,処女,0 ;non-virgin

;sex (1 = girl, 2 = boy, 3 = futa, 7 = andro)
素質,性別,1

;traits
素質,性的興味,1;Curious
素質,態度,-1; Docile
素質,無関心,1;Apathetic
素質,陽気/陰気,-1;Gloomy
素質,貞操,1;Virtuous
素質,倒錯的,1;Perverted
素質,性別嗜好,-1;Bisexual
素質,中毒しやすい,1;Easily Addicted
素質,絶倫,1;Unmatched
素質,C感度,1; Cock/Clit Sensitive
素質,バストサイズ,-1;small bewbs
素質,サド,1;sadist
素質,人間,1;human

;abilities
能力,清掃技能,1;cleaning
能力,話術技能,0;speech
能力,戦闘能力,3;combat
能力,教養,0;knowledge
能力,料理技能,0;cooking
能力,音楽技能,0;music
素質,伐採Lv,0;logging
素質,釣りLv,0;fishing
素質,採集Lv,0;foraging
素質,調合Lv,0;mixing

;sex abilities
能力,C感覚,2 ;Cock/Clit Sensitivity
能力,A感覚,1 ;Anus Sensitivity
能力,B感覚,1 ;Breast Sensitivity
能力,欲望,2 ;Desire
能力,レズっ気,2 ;Lesbianism
能力,サドっ気,3 ;Sadism

;flags
フラグ,地位,1000;地位

;starting location
フラグ,初期位置,242
;wake up hours
フラグ,起床時間,420;7時
;visiting hours
フラグ,来訪時間,540;9時
;going home
フラグ,帰宅時間,1080;18時
;sleeping
フラグ,就寝時間,1320;22時
;favorite place to visit
フラグ,よく行く地域,-1; stay
;general location
フラグ,自宅位置,270;kotohime's room
;フラグ,移動率補正,
フラグ,移動節度,0
;type of maternity leave
フラグ,産休タイプ,2;60日目から休む
;personality
フラグ,口調,2
;相性,
;work info
CSTR,仕事情報,Patrolling the Village every morning 06:00~12:00
CSTR,職場,Village - Square
;title
CSTR,10,~Princess Dreaming of Beauty in Danmaku~ ●Race:Human
;フラグ,産休タイプ,

Then the CHARADATA file can be copied from another place and then pasted to your modded ERB folder.

@CHARAMOVE_DATA_145(ARG, ARG:2)
LOCAL = 145
SELECTCASE ARG
    ;連動設定(RETURN=依存するキャラ, RESULT:1~3=対等に連動するキャラ)
	CASE 1
        ;特殊生活時間設定(CFLAG:LOCAL:生活時間補正を設定する)
        ;2hus the 2hu likes to go with
		RESULT:1 = [[アリス]]
		RESULT:2 = [[Shanghai]]
		RESULT:3 = [[Hourai]]
	CASE 3
    ;Frequency(±~10=More frequently goes to/Goes to less frequently, -100=Will never go)
	CASE 4
		SELECTCASE ARG:2
            ;Places that the 2hu likes to go to
			CASE P232蓮子の部屋, P233メリーの部屋, P202中央広場
				RETURN 5
            ;Places the 2hu will never go
			CASE P221稗田邸, P224慧音宅, P222寺子屋, P226小鈴私室, P229阿求私室
				RETURN -100
			CASE P208雷鼓の部屋, P209八橋の部屋, P210弁々の部屋
				RETURN -100
			CASE P231蛮奇の部屋, P234ユキの部屋, P235マイの部屋, P239美宵の部屋
				RETURN -100
		ENDSELECT
    ;Places the 2hu can go out
	CASE 7
		SELECTCASE ARG:2
			CASE 桜並木の鳥居, 神社境内, 神社本堂, 神社縁側, 夢幻遺跡
				RETURN 1
			CASE お地蔵通り, 枝垂れ柳の下, 命蓮寺境内, 墓地, 神霊廟広場
				RETURN 1
			CASE 広場, 商家町, 呑屋小道, 長屋街
				RETURN 1
			CASE 竹林入り口, 迷いの小道, 斜角の竹林, 兎の洞穴, 無名の丘, 太陽の畑
				RETURN 1
			CASE 中有の道, 三途の川
				RETURN 1
		ENDSELECT
    ;引力設定
	CASE 8
ENDSELECT

@EXIST_キャラデータ145
#LOCALSIZE 1
#LOCALSSIZE 1

@キャラデータ145(ARG, O_DATA, V_NAME)
#FUNCTION
#LOCALSIZE 1
#LOCALSSIZE 1
#DIMS O_DATA
#DIMS V_NAME
SELECTCASE O_DATA
	CASE "呼び名"
        ;Callname
		CALLF MAKE_STR(V_NAME, "Kotohime")
    ;こっから衣装設定
	CASE "今日のパジャマ"
        ;Pajama set
		CALLF MAKE_STR(V_NAME, "パジャマ(ワンピース)セット")
    ;Day Clothing
	CASE "普段着:着物"
        ;Kimono
		CALLF MAKE_INT(V_NAME, CLOTHES_ID("着物", "着物"))
	CASE "普段着:上半身上着1"
        ;Upper wear
		CALLF MAKE_INT(V_NAME, CLOTHES_ID("上半身上着1", "上着"))
	CASE "普段着:その他1"
        ;Accessory
		CALLF MAKE_INT(V_NAME, CLOTHES_ID("その他1", "リボン"))
	CASE "普段着:靴"
        ;Shoes
		CALLF MAKE_INT(V_NAME, CLOTHES_ID("靴", "靴"))
	CASE "普段着:靴下"
        ;Socks
		CALLF MAKE_INT(V_NAME, CLOTHES_ID("靴下", "靴下"))

    ;Unique Underwear
	CASE "固有下着形容詞"
		CALLF MAKE_STR(V_NAME, "rabbit printed")
	CASE "固有下半身下着名"
		CALLF MAKE_STR(V_NAME, "princess panties")

    ;Unique Bra
	CASE "固有上半身下着"
		CALLF MAKE_INT(V_NAME, 1)
	CASE "固有上半身下着名"
		CALLF MAKE_STR(V_NAME, "princess bra")

    ;Chance of wearing unique panties
	CASE "固有下着着用条件"
		SIF !RAND:(3 - (2 * 勝負下着判定([[Kotohime]])))
			CALLF MAKE_INT(V_NAME, 1)

    ;Panties Properties
	CASE "固有下着透ける(前)"
		CALLF MAKE_INT(V_NAME, 0)
	CASE "固有下着透ける(後)"
		CALLF MAKE_INT(V_NAME, 0)
	CASE "固有下着生地厚さ"
		CALLF MAKE_INT(V_NAME, 3)

    ;料理関連
    ;Tastes
	CASE "料理:好きな味"
		CALLF MAKE_STR(V_NAME, "精妙/" * 5 + "ふわふわ/" * 2 + "パイ/" * 2 + "サクサク/" * 3 + "揚げ物/" * 5 + "しょっぱい/" * 5 + "絢爛/" * 2 + "高級食材/" * 10 )
	CASE "料理:嫌いな味"
		CALLF MAKE_STR(V_NAME, "葉物/" * 2 + "すっぱい/" * 5 + "果物/" * 3 + "辛い辛い/" * 8 + "安物食材/" * 10 )
	CASE "料理:助手効果"
		CALLF MAKE_STR(V_NAME, "精妙/")

    ;贈り物関連
    ;Gift preferences
	CASE "感性:好き"
		CALLF MAKE_STR(V_NAME, "高級/金/かわいい/オシャレ/" + "宝石/" * 5 + "黄金の/" * 3)
	CASE "感性:嫌い"
		CALLF MAKE_STR(V_NAME, "奇妙/" + "安物/" * 3 + "妖力/グロテスク/" * 10)
ENDSELECT

;-------------------------------------------------
;固有料理設定
;DISH_NAME 料理名
;RESULTS 料理の種類(軽食/主食/デザート)
;CALL 材料設定("") 材料の指定。"汎用"を入れると自動で汎用食材になる
;DISH_TASTE 味の設定
;DISH_COMMENT (任意)一行コメント
;DISH_TIME (任意)調理にかかる時間
;DISH_MAXLIMIT (任意)料理の持続時間
;-------------------------------------------------
;Unique Food
@SPECIAL_MENU_145
DISH_NAME = Chicken Pot Pie
RESULTS = 主食
CALL 材料設定("汎用")
DISH_TASTE = 精妙/ふわふわ/パイ/サクサク/しょっぱい/肉料理/野菜抜き/
DISH_COMMENT = A savory pie with chicken inside. No vegetables though.
RETURN 1

Adding Diary Entries[edit]

In a nutshell: first you write a diary entry under `@DIARY_TEXT_KXX`, like so:

;※PAGENUM:0は使えません
SELECTCASE PAGENUM
    CASE 1
        PRINTFORML Well, I finally did it. I bought myself a diary.
        PRINTFORML Although I suppose it's more like a journal. What would I even write in a normal diary?
        PRINTFORML 「Nothing much happened on the bridge today. Went out drinking with Yuugi. Wanted to confess to her but didn't.」
        PRINTFORML 「Saw a bunch of people I was jealous of. Went home and seethed for a while. Paruparuparuparu.」
        PRINTFORML 「I hate myself.」
        PRINTFORML It would just be the same things over and over. No, I'm going to use this to blow off steam.
        PRINTFORML My anger, my jealousy, my self-hatred... I'm going to write about it here. Maybe it'll make me feel better.
        PRINTFORML At least I won't be burdening anyone else with my insufferable whining.

Then you set the conditions for it to show up in @DIARY_BEFORE_CHECK_KXX:

;Before she meets the player
IF DIARY:[[パルスィ]]:1 == 0
    SIF DIARY:[[パルスィ]]:1 != 0
	RETURN
    DIARY:[[パルスィ]]:1 = 3
    CALL CHARA_DIARY_PAGESETTING([[パルスィ]], 1)
ENDIF

The SIF check is necessary to avoid a single diary entry being displayed mltiple times.

It's probably better to write a helper function to avoid reduplicating code and prevent bugs. Like this:

SIF DIARY:[[パルスィ]]:ARG != 0
	RETURN
IF ARG:1 == 0 && CFLAG:[[パルスィ]]:K60EN_PARSEE_DIARY_WARNING == 2 && ABL:MASTER:教養 > 2
	DIARY:[[パルスィ]]:ARG = 2
ELSE
	DIARY:[[パルスィ]]:ARG = 3
	CALL CHARA_DIARY_PAGESETTING([[パルスィ]], ARG)
ENDIF

You can do other, more complicated requirements:

;Parsee is jealous of the player (Req: 1000+ Favorability)
SIF CFLAG:[[パルスィ]]:好感度 >= 1000
	CALL M_KOJO_DIARYSETTING_K60(9)

;Parsee has a crush on the player (Req: Parsee has Yearning)
SIF TALENT:思慕
	CALL M_KOJO_DIARYSETTING_K60(10)

;Parsee can't drive the player away (Req: 2000+ Favorability)
SIF CFLAG:[[パルスィ]]:好感度 >= 2000
	CALL M_KOJO_DIARYSETTING_K60(11)

;Parsee STILL can't drive the player away (Req: 2500+ Favorability)
SIF CFLAG:[[パルスィ]]:好感度 >= 2500
	CALL M_KOJO_DIARYSETTING_K60(12)

;Player saw Parsee crying in the tavern
SIF CFLAG:[[パルスィ]]:K60EN_PARSEE_CRYING_AT_THE_TAVERN > 0
	CALL M_KOJO_DIARYSETTING_K60(13)

;Parsee hates herself for melting down at you (Req: seeing Parsee's meltdown scene after you tried to push her down)
SIF !FIRSTTIME("ParseeTooJealousForSex", 1)
	CALL M_KOJO_DIARYSETTING_K60(17)

;Parsee lost her virginity to the player
SIF CFLAG:K60EN_PARSEE_STARTING_VIRGINITY && !K60_PARSEE_THINKS_IS_VIRGIN()
	CALL M_KOJO_DIARYSETTING_K60(14)

;Parsee wants to do kinky shit with the player (Req: Parsee is in the Loving or Horny attitude and the player has had sex with her at least once)
SIF GROUPMATCH(K60_ATTITUDE(), 0, 1) && (CFLAG:[[パルスィ]]:既成事実 & 合意_うふふ)
	CALL M_KOJO_DIARYSETTING_K60(15)

Setting the DIARY:(character ID):(entry ID) variable to 2 will make that diary entry display at the end of the day once it becomes available to read. Setting it to 3 will just make it available to read.

You can customize what portrait the character uses for diary entries that display at the end of the day:

        ;For entry 15, use the horny portrait, naked, with blush effects
	IF PAGENUM == 15
		CALL PRINT_FACE, 60, "発情", "裸", "_1"
        ;For entry 14, use the happy portrait with outfit 1
	ELSEIF PAGENUM == 14
		CALL PRINT_FACE, 60, "笑顔", "服1"
        ;For entries 3, 4, 8, 9, 10, 12, and 17, use the angry portrait
	ELSEIF GROUPMATCH(PAGENUM, 3, 4, 8, 9, 10, 12, 17)
		CALL PRINT_FACE, 60, "怒り"
	ELSE
		CALL PRINT_FACE, 60
	ENDIF

Snippets[edit]

Place these in your VS Code snippets file.

{
  "Line of dialogue with quotes": {
    "prefix": "quotes",
    "body": ["PRINTFORML 「$1」"]
  },
  "Line of dialogue without quotes": {
    "prefix": "printformdl",
    "body": ["PRINTFORMDL $1"]
  },
  "Line of dialogue with quotes (wait)": {
    "prefix": "quoteswait",
    "body": ["PRINTFORMW 「$1」"]
  },
  "Line of dialogue without quotes (wait)": {
    "prefix": "printformdw",
    "body": ["PRINTFORMDW $1"]
  },
  "Line separator": {
    "prefix": "newline",
    "body": ["PRINTFORML ", "$1"]
  },
  "He or she (TARGET)": {
    "prefix": "shehetarget",
    "body": ["%HE_SHE(TARGET)%$1"]
  },
  "Him or her (TARGET)": {
    "prefix": "herhimtarget",
    "body": ["%HIM_HER(TARGET)%$1"]
  },
  "His or her (TARGET)": {
    "prefix": "herhistarget",
    "body": ["%HIS_HER(TARGET)%$1"]
  },
  "Man or woman (TARGET)": {
    "prefix": "manwomantarget",
    "body": ["%PRINT_MALE(\"man\", TARGET)%$1"]
  },
  "Boy or girl (MASTER)": {
    "prefix": "boygirlmaster",
    "body": ["%PRINT_MALE(\"boy\", MASTER)%$1"]
  },
  "Boy or girl (TARGET)": {
    "prefix": "boygirltarget",
    "body": ["%PRINT_MALE(\"boy\", TARGET)%$1"]
  },
  "Guys or girls (TARGET)": {
    "prefix": "guysgirlstarget",
    "body": ["%PRINT_MALE(\"guy\", TARGET)%s$1"]
  },
  "He or she (MASTER)": {
    "prefix": "shehemaster",
    "body": ["%HE_SHE(MASTER)%$1"]
  },
  "Him or her (MASTER)": {
    "prefix": "herhimmaster",
    "body": ["%HIM_HER(MASTER)%$1"]
  },
  "His or her (MASTER)": {
    "prefix": "herhismaster",
    "body": ["%HIS_HER(MASTER)%$1"]
  },
  "Man or woman (MASTER)": {
    "prefix": "manwomanmaster",
    "body": ["%PRINT_MALE(\"man\", MASTER)%$1"]
  },
  "HPH_PRINT": {
    "prefix": "hph",
    "body": ["CALL HPH_PRINT, @\"「$1」\", \"W\""]
  },
  "ITALICS_PRINT": {
    "prefix": "italics",
    "body": ["CALL PRINT_STRL, @\"「$1@ITALIC@@」\""]
  },
  "Parse \"you\"": {
    "prefix": "youparse",
    "body": ["%PARSE(\"you $1\")%"]
  },
  "Parse \"you\" (capitalized)": {
    "prefix": "youcapitalizedparse",
    "body": ["%PARSE(\"You $1\")%"]
  },
  "Parse \"your\"": {
    "prefix": "yourparse",
    "body": ["%PARSE(\"your\")%$1"]
  },
  "Penis synonyms": {
    "prefix": "penis",
    "body": ["%FSYN(\"penis\")%$1"]
  },
  "Vagina synonyms": {
    "prefix": "vagina",
    "body": ["%FSYN(\"vagina\")%$1"]
  },
  "Semen synonyms": {
    "prefix": "semen",
    "body": ["%SEMEN()%$1"]
  },
  "Pussy juice synonyms": {
    "prefix": "juice",
    "body": ["%FSYN(\"juice\")%$1"]
  },
  "Japanese double quotation marks (nijuukagikakko)": {
    "prefix": "doublequotes",
    "body": ["『$1』"]
  },
  "fullwidth-h": {
    "prefix": "fullwidth-h",
    "body": ["H$1"]
  },
  "Penis or strapon (master)": {
    "prefix": "penisorstraponmaster",
    "body": ["\\@ HAS_PENIS(MASTER) ? %FSYN(\"penis\")% # strap-on \\@$1"]
  },
  "Penis or strapon (target)": {
    "prefix": "penisorstrapontarget",
    "body": ["\\@ HAS_PENIS(TARGET) ? %FSYN(\"penis\")% # strap-on \\@$1"]
  },
  "Target has penis check, mid sentence": {
    "prefix": "haspenismidsentencetarget",
    "body": ["\\@ HAS_PENIS(TARGET) ? $1 # \\@"]
  },
  "Master has penis check, mid sentence": {
    "prefix": "haspenismidsentencemaster",
    "body": ["\\@ HAS_PENIS(TARGET) ? $1 # \\@"]
  },
  "other has penis check, mid sentence": {
    "prefix": "haspenismidsentenceother",
    "body": ["\\@ HAS_PENIS($1) ? # \\@"]
  },
  "Master is handsome or beautiful": {
    "prefix": "handsomebeautiful",
    "body": ["\\@ IS_MALE(MASTER) ? handsome # beautiful\\@$1"]
  },
  "Is male check, target": {
    "prefix": "ismaletarget",
    "body": ["\\@ IS_MALE(TARGET) ? $1 # \\@"]
  },
  "Moan": {
    "prefix": "moan",
    "body": ["%MOAN(\"l\")%$1"]
  },
  "Tilde": {
    "prefix": "tilde",
    "body": ["~$1"]
  },
  "Bust size selectcase, target": {
    "prefix": "bustsizeselecttarget",
    "body": [
      "SELECTCASE TALENT:TARGET:バストサイズ",
      "\t;Big/Huge",
      "\tCASE 1, 2",
      "\t\tPRINTFORMW ",
      "\t;Normal",
      "\tCASE 0",
      "\t\tPRINTFORML ",
      "\t;Small",
      "\tCASE -1",
      "\t\tPRINTFORML ",
      "\t;Flat",
      "\tCASE -2",
      "\t\tPRINTFORML ",
      "ENDSELECT"
    ]
  },
  "Bust size selectcase, master": {
    "prefix": "bustsizeselectmaster",
    "body": [
      "SELECTCASE TALENT:MASTER:バストサイズ",
      "\t;Big/Huge",
      "\tCASE 1, 2",
      "\t\tPRINTFORMW ",
      "\t;Normal",
      "\tCASE 0",
      "\t\tPRINTFORML ",
      "\t;Small",
      "\tCASE -1",
      "\t\tPRINTFORML ",
      "\t;Flat",
      "\tCASE -2",
      "\t\tPRINTFORML ",
      "ENDSELECT"
    ]
  },
  "Lover (target)": {
    "prefix": "lovertarget",
    "body": ["TALENT:TARGET:恋人$1"]
  },
  "Lover (master)": {
    "prefix": "lovermaster",
    "body": ["TALENT:MASTER:恋人$1"]
  },
  "Lover (other)": {
    "prefix": "lover",
    "body": ["TALENT:$1:恋人"]
  },
  "Girlfriend/boyfriend (master)": {
    "prefix": "girlfriendboyfriendmaster",
    "body": ["%PRINT_MALE(\"boy\", MASTER)%friend$1"]
  },
  "Girlfriend/boyfriend (target)": {
    "prefix": "girlfriendboyfriendtarget",
    "body": ["%PRINT_MALE(\"boy\", TARGET)%friend$1"]
  },
  "Girlfriend/boyfriend" (other): {
    "prefix": "girlfriendboyfriend",
    "body": ["%PRINT_MALE(\"boy\", $1)%friend"]
  },
  "Master": {
    "prefix": "master",
    "body": ["%CALLNAME:MASTER%"]
  },
  "If player is alone, else": {
    "prefix": "playeralone",
    "body": ["IF LOCAL:3 == 1", "$1", "ELSE", "ENDIF"]
  },
  "If playing as": {
    "prefix": "playingas",
    "body": ["IF FLAG:なりきり == $1"]
  },
  "Panties": {
    "prefix": "panties",
    "body": ["%PANTSNAME(TARGET)%"]
  },
  "Bottom": {
    "prefix": "bottom",
    "body": ["%SHOW_BOTTOM($1,1)%"]
  },
  "Semen Addiction": {
    "prefix": "semenaddiction",
    "body": ["ABL:TARGET:精液中毒$1%"]
  },
  "Cum consumed": {
    "prefix": "cumconsumed",
    "body": ["CFLAG:TARGET:累計精飲$1"]
  },
  "Player is masochist": {
    "prefix": "playerismasochist",
    "body": ["ABL:MASTER:マゾっ気 >= 2$1"]
  },
  "Non-human (if you want to add custom dialogue for youkai MCs)": {
    "prefix": "nonhuman",
    "body": [
      "TALENT:MASTER:狐 || TALENT:MASTER:妖狐 || TALENT:MASTER:吸血鬼 ||TALENT:MASTER:動物耳$1"
    ]
  },
  "If master has an erection": {
    "prefix": "haserectionmaster",
    "body": ["BASE:MASTER:勃起 >= 1000$1"]
  },
  "If the target has an erection": {
    "prefix": "haserectiontarget",
    "body": ["BASE:TARGET:勃起 >= 1000$1"]
  },
  "Mouth skill (master)": {
    "prefix": "mouthskillmaster",
    "body": ["ABL:MASTER:M感覚 >= 2$1"]
  },
  "Mouth skill (target)": {
    "prefix": "mouthskilltarget",
    "body": ["ABL:MASTER:M感覚 >= 2$1"]
  },
  "Unconscious sex (time stop/sleeping/drunk) variants": {
    "prefix": "unconsciousvariants",
    "body": [
      ";基本セット",
      "\t;Time stop",
      "\t;時姦中",
      "\tIF FLAG:70",
      "\t\tPRINTFORML",
      "\t\tRETURN 1",
      "\t;睡姦中",
      "\t;Sleep rape",
      "\tELSEIF CFLAG:MASTER:イタズラ == 2",
      "\t\tSELECTCASE RAND:3",
      "\t\tCASE 0",
      "\t\t\tPRINTFORML ",
      "\t\tCASE 1",
      "\t\t\tPRINTFORML ",
      "\t\tCASE 2",
      "\t\t\tPRINTFORML ",
      "\t\tENDSELECT",
      "\t\tRETURN 1",
      "\t;Character is drunk",
      "\tELSEIF TCVAR:TARGET:泥酔 == 1",
      "\t\tSELECTCASE RAND:3",
      "\t\tCASE 0",
      "\t\t\tPRINTFORML ",
      "\t\tCASE 1",
      "\t\t\tPRINTFORML ",
      "\t\tCASE 2",
      "\t\t\tPRINTFORML ",
      "\t\tENDSELECT",
      "\t\tRETURN 1",
      "\tELSE",
      "\t;Other cases",
      "\tENDIF"
    ]
  },
  "Indoors": {
    "prefix": "indoors",
    "body": "INROOM(CFLAG:MASTER:現在位置)"
  },
  "Check if the target has 2 or more Masochism": {
    "prefix": "ismasochisttarget",
    "body": "ABL:TARGET:マゾっ気 >= 2"
  },
  "Check if the player has 2 or more Masochism": {
    "prefix": "ismasochistplayer",
    "body": "ABL:MASTER:マゾっ気 >= 2"
  },
  "Generate three random cases": {
    "prefix": "rand3",
    "body": [
      "SELECTCASE RAND:3",
      "\tCASE 0",
      "\t\tPRINTFORML ",
      "\tCASE 1",
      "\t\tPRINTFORML ",
      "\tCASE 2",
      "\t\tPRINTFORML ",
      "ENDSELECT"
    ]
  },
  "Target is at work": {
    "prefix": "working",
    "body": "CFLAG:TARGET:職種"
  },
  "Set the dialogue color to a character's dialogue color": {
    "prefix": "color",
    "body": "CALL M_KOJO_COLOR_K$1"
  },
  "If you've had sex with a character (consent flag or been pushed down flag)": {
    "prefix": "hasfucked",
    "body": "CFLAG:$1:既成事実 & 合意_うふふ"
  },
  "Target is pregnant": {
    "prefix": "ispregnant",
    "body": "TALENT:TARGET:妊娠$1"
  },
  "Move the master out of the current area": {
    "prefix": "kickoutmaster",
    "body": "CFLAG:MASTER:現在位置 = KICKOUT()$1"
  },
  "Move the target out of the current area": {
    "prefix": "kickouttarget",
    "body": "CFLAG:TARGET:現在位置 = KICKOUT()$1"
  },
  "Move another character out of the current area": {
    "prefix": "kickoutother",
    "body": "CFLAG:$1:現在位置 = KICKOUT()"
  },
  "Slurred moan": {
    "prefix": "slurredmoan",
    "body": "%SLUR(MOAN(\"m\"), -2)%"
  },
  "Target has Love": {
    "prefix": "targetlove",
    "body": "TALENT:TARGET:恋慕$1"
  },
  "BREAKENG": {
    "prefix": "breakeng",
    "body": "%BREAKENG(@\"$1\")%"
  },
  "PRINT_DIALOGUE": {
    "prefix": "printdialogue",
    "body": "CALL PRINT_DIALOGUE, \"$1\""
  },
  "SPLIT_G": {
    "prefix": "splitg",
    "body": "%SPLIT_G(\":\")"
  },
  "Target has Hate Mark 3": {
    "prefix": "hatemark",
    "body": "MARK:TARGET:反発刻印 >= 3$1"
  },
  "Player has met a character": {
    "prefix": "hasmet",
    "body": "CFLAG:$1:面識"
  },
  "Character has Yearning": {
    "prefix": "yearning",
    "body": "TALENT:$1:思慕"
  },
  "Ryona Fetish Check NAS": {
  "prefix": "NASryona",
  "body": ["VINUM_OMOGATARI_FEATURE_CHECK(\"ryona\")"]
  },
  "Pee Accident Fetish Check NAS": {
  "prefix": "NASpee",
  "body": ["GETBIT(RETURN_VAR_VALUE_IF_EXISTS(\"nPee\"),1)"]
  },
  "Poo Accident Fetish Check NAS": {
  "prefix": "NASscat",
  "body": ["GETBIT(RETURN_VAR_VALUE_IF_EXISTS(\"nScat\"),2)"]
  },
  "Diaper Fetish Check NAS": {
  "prefix": "NASomutsu",
  "body": ["RETURN_VAR_VALUE_IF_EXISTS(\"nOmutsu\")"]
  },
  "Necrophilia Fetish Check NAS": {
  "prefix": "NASnecro",
  "body": ["RETURN_VAR_VALUE_IF_EXISTS(\"nNecro\")"]
  },
 //NAS Exclusive
  "If playing as NAS": {
  "prefix": "NASplayingas",
  "body": ["IF MASTER == $1"]
  },
  "Panties NAS": {
  "prefix": "NASpanties",
  "body": ["%PeeProtectType(TARGET)%"]
  },
  "Generic Panties NAS": {
  "prefix": "NASpantiesgeneric",
  "body": ["%PeeProtectType(TARGET, 1)%"]
  },
  "Weapon NAS": {
  "prefix": "NASweapon",
  "body": ["%GET_STR(TARGET, \"Weapon\", EQUIP:TARGET:24, \"名前\")%"]
  },
  "Change Underwear NAS": {
  "prefix": "NASdiaperchange",
  "body": ["CALL DiaperChange(TARGET, 103)"]
  }
  "Bust size selectcase, target, NAS": {
    "prefix": "NASbustsizeselecttarget",
    "body": [
      "SELECTCASE TALENT:TARGET:バストサイズ",
      "\t;Gigantic/Mystifying",
      "\tCASE 3, 4",
      "\t\tPRINTFORMW ",
      "\t;Big/Huge",
      "\tCASE 1, 2",
      "\t\tPRINTFORMW ",
      "\t;Normal",
      "\tCASE 0",
      "\t\tPRINTFORML ",
      "\t;Small",
      "\tCASE -1",
      "\t\tPRINTFORML ",
      "\t;Tiny",
      "\tCASE -2",
      "\t\tPRINTFORML ",
      "\t;Flat",
      "\tCASE -3",
      "\t\tPRINTFORML ",
      "ENDSELECT"
    ]
  },
  "Bust size selectcase, master, NAS": {
    "prefix": "NASbustsizeselectmaster",
    "body": [
      "SELECTCASE TALENT:MASTER:バストサイズ",
      "\t;Gigantic/Mystifying",
      "\tCASE 3, 4",
      "\t\tPRINTFORMW ",
      "\t;Big/Huge",
      "\tCASE 1, 2",
      "\t\tPRINTFORMW ",
      "\t;Normal",
      "\tCASE 0",
      "\t\tPRINTFORML ",
      "\t;Small",
      "\tCASE -1",
      "\t\tPRINTFORML ",
      "\t;Tiny",
      "\tCASE -2",
      "\t\tPRINTFORML ",
      "\t;Flat",
      "\tCASE -3",
      "\t\tPRINTFORML ",
      "ENDSELECT"
    ]
  },

}

TW Flags and Variables (with English explanations)[edit]

CFLAGs

Talents

ABLs

Other stuff[edit]

grep commands

Everything you can write lines for

Who should I write a dialogue for?