Difference between revisions of "Contributing/eralang"

From Era Wiki
Jump to: navigation, search
(Created page with "<big>'''THIS IS THE OLD TRANSLATION GUIDE. IT NEEDS UPDATED. ASK IN THE DISCORD BEFORE DOING ANYTHING.'''</big> = Basics: = ==PRINT== Everything after a PRINT statement is ea...")
(Corrected some formating on the code parts. Expanded on some parts like ternary ifs. This is more of a correction and adding a line or two, so I didn't feel like needing to ask on discord)
Line 15: Line 15:
  
 
<blockquote>
 
<blockquote>
'''PRINT varients "S" or "V" should not be translated, they are for quick variable use without needing to write %% or {}'''  
+
'''PRINT variants "S" or "V" should not be translated, they are for quick variable use without needing to write %% or {}'''  
 
</blockquote>
 
</blockquote>
 
   
 
   
Line 51: Line 51:
 
To translate it, you'll need to create a new file named accordingly ("TALENT_TR.csv", "ABL_TR.csv", etc.)
 
To translate it, you'll need to create a new file named accordingly ("TALENT_TR.csv", "ABL_TR.csv", etc.)
 
The syntax is:
 
The syntax is:
::処女,Virgin
+
処女,Virgin
::自制心,Self Control
+
自制心,Self Control
  
 
=== About statistics and flags from .csv files: ===
 
=== About statistics and flags from .csv files: ===
Line 63: Line 63:
 
Of ccourse, instead of <code>ABLNAME</code> you can also use things like <code>BASENAME</code>, <code>EXPNAME</code>, <code>ITEMNAME</code>, etc.
 
Of ccourse, instead of <code>ABLNAME</code> you can also use things like <code>BASENAME</code>, <code>EXPNAME</code>, <code>ITEMNAME</code>, etc.
  
== Examples of basic emuera syntax: ==
+
== Examples of basic emuera syntax ==
 
   
 
   
---PRINT instructions----------------------------
+
===PRINT instructions===
  ;suffixes for PRINT instructions (in order of possible usage):
+
Suffixes for PRINT instructions (in order of possible usage):
PRINT(SINGLE|PLAIN)(V|S|FORM|FORMS|FORMV)(K|D)(L|W)
+
 
    SINGLE      - cuts the part of text that normally would get shown in the next line
+
PRINT(SINGLE|PLAIN)(V|S|FORM|FORMS|FORMV)(K|D)(L|W)
    PLAIN      - disables ability for text to be recognized as button
+
* SINGLE      - cuts the part of text that normally would get shown in the next line
    V          - for numbers ({}); instead of "PRINTFORM {LOCAL}" you can write "PRINTFORMV LOCAL"
+
* PLAIN      - disables ability for text to be recognized as button
    S          - equivalent of strings (%%)
+
* V          - for numbers ({}); instead of "PRINTFORM {LOCAL}" you can write "PRINTFORMV LOCAL"
    K          - something with forcing kana (extremely rarely used)
+
* S          - equivalent of strings (%%)
    D          - ignores color change from SETCOLOR
+
* K          - something with forcing kana (extremely rarely used)
    L          - makes line after printing the text
+
* D          - ignores color change from SETCOLOR
    W          - waits for player input
+
* L          - makes line after printing the text
 +
* W          - waits for player input
 
   
 
   
  ;example of PRINTFORM usage:
+
Example of PRINTFORM usage:
LOCALS = This
+
LOCALS = This
LOCAL = 8
+
LOCAL = 8
PRINTFORML %LOCALS% can use strings, and numbers like {LOCAL}
+
PRINTFORML %LOCALS% can use strings, and numbers like {LOCAL}
  result: "This can use strings, and numbers like 8<next line>"
+
 
 +
result: "This can use strings, and numbers like 8<next line>"
 
   
 
   
  ;short form of IF inside PRINTFORM
+
====Short form of IF inside PRINTFORM====
PRINTFORM ARG is \@ARG > 5 ? more than 5 # less or equal to 5 \@ stuff
+
Also called ternary if or ternary operator
 +
 
 +
PRINTFORM ARG is \@ARG > 5 ? more than 5 # less or equal to 5 \@ stuff
 +
 
 +
Note: It ignores the spaces around the edges of <code>?</code> and <code>#</code>
 +
 
 +
====Other PRINT examples====
 +
 
 +
PRINT [15] button number 15
 +
PRINTBUTTON "text that will highlight, without need to add [16]", 16
 +
 
 +
You can add <code>@</code> before a <code>"</code> to make it also format <code>%%</code> and <code>{}</code> like so:
 +
 
 +
LOCALS = this
 +
PRINTBUTTON @"Click %LOCALS to continue", 10
 +
 
 +
===Conditional statements===
 
   
 
   
PRINT [15] button number 15
+
IF ARG >= 50
PRINTBUTTON "text that will highlight, without need to add [16]", 16
+
    ;if ARG is greater than or equal 50
 +
ELSEIF ARG == 20
 +
    ;if ARG equals 20
 +
ELSE
 +
    ;every other condition
 +
ENDIF
 
   
 
   
 +
====Ternary Operator====
 
   
 
   
---Conditional statements------------------------
+
SIF ARG == 420
 +
    ;short IF, executes only one instruction that's directly under it
 
   
 
   
IF ARG >= 50
+
====Short IF====
    ;if ARG is greater than or equal 50
+
 
ELSEIF ARG == 20
+
  PRINTFORML If inside the PRINTFORM instructions: \@ IS_MALE(TARGET) ? he # she \@.
    ;if ARG equals 20
+
 
ELSE
+
Note: It ignores the spaces used around the edges of he/she
    ;every other condition
 
ENDIF
 
   
 
------------------------
 
 
SIF ARG == 420
 
    ;short IF, executes only one instruction that's directly under it
 
 
------------------------
 
 
   
 
   
  ;Even shorter IF
 
PRINTFORML If inside the PRINTFORM instructions: \@ IS_MALE(TARGET) ? he # she \@.
 
;note that it ignores the spaces used around the edges of he/she
 
 
   
 
   
 +
===Case===
 
   
 
   
---Case------------------------------------------
+
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
 
   
 
   
SELECTCASE ARG
+
===Loops===
    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
 
 
   
 
   
   
+
  FOR LOCAL, 0, 42
---Loops-----------------------------------------
+
    ;loop that will go from 0 to 42 (excluding 42)
+
    ;LOCAL here is variable holding of current loop count
FOR LOCAL, 0, 42
+
    SIF LOCAL == 5
    ;loop that will go from 0 to 42 (excluding 42)
+
        CONTINUE            ;it skips case 5 and goes to next one - that is 6
    ;LOCAL is variable holding of current loop count
+
    ;stuff
    SIF LOCAL == 5
+
    SIF LOCAL == 12
        CONTINUE            ;it skips case 5 and goes to next one - that is 6
+
        BREAK              ;exits the loop completely, ignoring whether it's the last time (42 in this case)
    ;stuff
+
NEXT
    SIF LOCAL == 12
 
        BREAK              ;exits the loop completely, ignoring whether it's the last time (42 in this case)
 
NEXT
 
 
   
 
   
 
------------------------
 
------------------------
WHILE !LOCAL
+
WHILE !LOCAL
    ;this continues as long as LOCAL == 0
+
    ;this continues as long as LOCAL == 0
WEND
+
WEND
 
------------------------
 
------------------------
REPEAT 5
+
REPEAT 5
    ;repeats itself 5 times
+
    ;repeats itself 5 times
    ;uses global variable COUNT for ... counting
+
    ;uses global variable COUNT for ... counting
REND
+
REND
 
------------------------
 
------------------------
 
   
 
   
 
   
 
   
---Changing text colors--------------------------
+
===Changing text colors===
 
   
 
   
;Changing text colors
+
SETCOLOR 204, 0, 102    ;in rgb
SETCOLOR 204, 0, 102    ;in rgb
+
SETCOLOR 0xff00ff      ;in hex
SETCOLOR 0xff00ff      ;in hex
+
SETCOLOR C_RED          ;it also supports constant variables
SETCOLOR C_RED          ;it also supports constant variables
+
SETCOLOR FOO("red")    ;and functions
SETCOLOR FOO("red")    ;and functions
 
 
   
 
   
RESETCOLOR              ;use this when you're finished with fancy coloring
+
RESETCOLOR              ;use this when you're finished with fancy coloring
+
 
+
===Example function construction===
 
------Example function construction--------
 
  
@USELESS_FUNCTION(ARG)
+
@USELESS_FUNCTION(ARG)
LOCALS:1 =                          ;need to clear it because if you repeat this function the "+=" will add text to string again and again
+
LOCALS:1 =                          ;need to clear it because if you repeat this function the "+=" will add text to string again and again
 
   
 
   
SIF !IS_MALE(ARG)
+
SIF !IS_MALE(ARG)
    LOCALS:1 += "pussy and "        ;when using += for a string you'll have to use quotes
+
    LOCALS:1 += "pussy and "        ;when using += for a string you'll have to use quotes
LOCALS:1 += "asshole"              ;(this also makes adding space at the edge of string possible)
+
LOCALS:1 += "asshole"              ;(this also makes adding space at the edge of string possible)
 
   
 
   
FOR LOCAL, 0, CHARANUM              ;CHARANUM is constant that means number of static (in chara folder) characters
+
FOR LOCAL, 0, CHARANUM              ;CHARANUM is constant that means number of static (in chara folder) characters
    LOCAL:1 ++                      ;increment LOCAL:1 (it's short for LOCAL:1 = LOCAL:1 + 1)
+
    LOCAL:1 ++                      ;increment LOCAL:1 (it's short for LOCAL:1 = LOCAL:1 + 1)
NEXT
+
NEXT
 
   
 
   
;(you can add spaces at the edges of PRINTs btw)
+
;(you can add spaces at the edges of PRINTs, btw)
PRINTFORM %CALLNAME:ARG%'s %LOCALS:1% got rekt
+
PRINTFORM %CALLNAME:ARG%'s %LOCALS:1% got rekt
 
   
 
   
SETCOLOR 255,0,0
+
SETCOLOR 255,0,0
PRINTFORM {LOCAL:1}
+
PRINTFORM {LOCAL:1}
RESETCOLOR
+
RESETCOLOR
 
   
 
   
PRINTW times                            ;pause and line
+
PRINTW times                            ;pause and line
RETURN                                  ;it returns to previously used function that used "CALL USELESS_FUNCTION(TARGET)"
+
RETURN                                  ;it returns to previously used function that used "CALL USELESS_FUNCTION(TARGET)"
  
 
==Git Workflow==
 
==Git Workflow==
 
[[File:Eragames Git Workflow.png|thumbnail|left|This is the current workflow all games with active translation abide by.]]
 
[[File:Eragames Git Workflow.png|thumbnail|left|This is the current workflow all games with active translation abide by.]]

Revision as of 17:09, 23 April 2019

THIS IS THE OLD TRANSLATION GUIDE. IT NEEDS UPDATED. ASK IN THE DISCORD BEFORE DOING ANYTHING.

Basics:

PRINT

Everything after a PRINT statement is easily translated, with nothing more needed than replacing the Japanese text with English.

PRINT 
simply write stuff, in one line, without any variables
PRINTL 
Same as PRINT, except it adds a new line after printing.
PRINTW 
Same as PRINT, except waits for the player to click/press a button
PRINTFORM 
can use variables (strings: %CALLNAME%, and numbers: {LOCAL})
PRINTFORML 
Same as PRINTFORM, except it adds a new line after printing
PRINTFORMW 
Same as PRINTFORM, except waits for the player to click/press a button

Feel free to edit/add/remove all PRINT(FORM) functions until whatever you're attempting to print looks and reads correctly.

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


CALL_japanese_text

Don't translate these, They're for calling functions. If structure is something like CALL xxx("text","othertext",1) you can most likely translate what's inside quotation marks.

Comments

Comments are designated by a semicolon (;) and have no effect on the code. Generally we do not translate comments left by the Japanese, though you are free to write your own.

Skips

[SKIPSTART] and [SKIPEND]
comment for disabling whole segment of code between start and stop

Character Referal

%CALLNAME:<target>% 
When used with PRINTFORM, it displays the name of the target
<target> can be MASTER, TARGET, etc.
%HIS_HER(TARGET)%, %HIM_HER(PLAYER)% %HE_SHE(TARGET)% (sometimes also %TOSTR_THIRD(TARGET)%) 
gets the gender pronoun of the targeted character.

You can also start with capital letter when you add ",1" after the variable like: %any_function(TARGET,1)%

Variables

MASTER, TARGET, PLAYER, ASSISTANT - Special variables that hold ID of your and characters that you currently interact with CHARANUM - total number of characters available in the game (read only)

If you use any variation of PRINTFORM you can use variables like names of characters, numbers for stats or custom functions

{} - is for numbers,
%% - is for text

Translating .csv files:

Things like the "Virgin" talent, or the ability "C Sensitivity" are located in .csv files in the /CSV/ folder ("TALENT.csv", "ABL.csv", etc.)

DO NOT translate them directly, we now have modified the emuera engine for that.

To translate it, you'll need to create a new file named accordingly ("TALENT_TR.csv", "ABL_TR.csv", etc.) The syntax is:

処女,Virgin
自制心,Self Control

About statistics and flags from .csv files:

There are arrays for different variables divided into "groups" that are in CSV folders. TALENT's are in Talent.csv, ABL are in Abl.csv. BASE are in BASE.csv, etc.

When you want to show a statistic, let's say ENE (energy) of player character with PRINTFORM, you use something like this: {BASE:MASTER:ENE}

There is also a way to show name from .csv file. For example, if you use: %ABLNAME:LOCAL% it will show the corresponding name for number, like for eraTW with LOCAL = 4 it'll show "MSense" Of ccourse, instead of ABLNAME you can also use things like BASENAME, EXPNAME, ITEMNAME, etc.

Examples of basic emuera syntax

PRINT instructions

Suffixes for PRINT instructions (in order of possible usage):

PRINT(SINGLE|PLAIN)(V|S|FORM|FORMS|FORMV)(K|D)(L|W)
  • SINGLE - cuts the part of text that normally would get shown in the next line
  • PLAIN - disables ability for text to be recognized as button
  • 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

Example of PRINTFORM usage:

LOCALS = This
LOCAL = 8
PRINTFORML %LOCALS% can use strings, and numbers like {LOCAL}

result: "This can use strings, and numbers like 8<next line>"

Short form of IF inside PRINTFORM

Also called ternary if or ternary operator

PRINTFORM ARG is \@ARG > 5 ? more than 5 # less or equal to 5 \@ stuff

Note: It ignores the spaces around the edges of ? and #

Other PRINT examples

PRINT [15] button number 15
PRINTBUTTON "text that will highlight, without need to add [16]", 16

You can add @ before a " to make it also format %% and {} like so:

LOCALS = this
PRINTBUTTON @"Click %LOCALS to continue", 10

Conditional statements

IF ARG >= 50
    ;if ARG is greater than or equal 50
ELSEIF ARG == 20
    ;if ARG equals 20
ELSE
    ;every other condition
ENDIF

Ternary Operator

SIF ARG == 420
    ;short IF, executes only one instruction that's directly under it

Short IF

PRINTFORML If inside the PRINTFORM instructions: \@ IS_MALE(TARGET) ? he # she \@.

Note: It ignores the spaces used around the edges of he/she


Case

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

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 !LOCAL
    ;this continues as long as LOCAL == 0
WEND

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


Changing text colors

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

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

Example function construction

@USELESS_FUNCTION(ARG)
LOCALS:1 =                          ;need to clear it because if you repeat this function the "+=" will add text to string again and again

SIF !IS_MALE(ARG)
    LOCALS:1 += "pussy and "        ;when using += for a string you'll have to use quotes
LOCALS:1 += "asshole"               ;(this also makes adding space at the edge of string possible)

FOR LOCAL, 0, CHARANUM              ;CHARANUM is constant that means number of static (in chara folder) characters
    LOCAL:1 ++                      ;increment LOCAL:1 (it's short for LOCAL:1 = LOCAL:1 + 1)
NEXT

;(you can add spaces at the edges of PRINTs, btw)
PRINTFORM %CALLNAME:ARG%'s %LOCALS:1% got rekt

SETCOLOR 255,0,0
PRINTFORM {LOCAL:1}
RESETCOLOR

PRINTW times                            ;pause and line
RETURN                                  ;it returns to previously used function that used "CALL USELESS_FUNCTION(TARGET)"

Git Workflow

This is the current workflow all games with active translation abide by.