Difference between revisions of "Emuera/eramaerb"

From Era Wiki
Jump to: navigation, search
(translated half of the page)
(1行で完結: title translation)
Line 61: Line 61:
 
PRINT "The day is over..."</nowiki>
 
PRINT "The day is over..."</nowiki>
  
====1行で完結====
+
====It' s all in one line====
 
Even when writing long instructions, don't split them into more than two lines.<BR>
 
Even when writing long instructions, don't split them into more than two lines.<BR>
 
  <nowiki>
 
  <nowiki>
Line 72: Line 72:
 
PRINT  
 
PRINT  
 
Nayuki's body was sensitive and she had a lot of experience, so she was happy even if it was a little rough. Even though she denies it with her mouth, Nayuki is getting more and more promiscuous. But the peculiar circumstance of her being asleep made me hesitant to make a bolder move.</nowiki>
 
Nayuki's body was sensitive and she had a lot of experience, so she was happy even if it was a little rough. Even though she denies it with her mouth, Nayuki is getting more and more promiscuous. But the peculiar circumstance of her being asleep made me hesitant to make a bolder move.</nowiki>
 
  
 
==Variables and Instructions==
 
==Variables and Instructions==

Revision as of 21:36, 8 April 2020

eramaker ERB file format (provisional)
I think it's hard to get a picture just by looking at this file. It is easier to understand if you play the sample game first, and then look at the ERB files of the sample game while looking at it.

Basic Info

About the ERB file

  • Put a folder named ERB directly under eramaker.exe, and put ERB file in it.
  • You can use any file name as long as the extension is .ERB
  • Please edit it with a text editor such as Notepad.

How to write an ERB file

Comments & Spaces

In all ERB files,

  • If the first character in the first column is a ; (semicolon), the line is ignored. Empty lines are also ignored.
  • Don't put a semicolon at the end of a line, or a comment after it. Both ways can be done in Emuera.
  • Any number of spaces or tabs at the beginning of a line will be ignored.
; CORRECT

;Setting up the money
MONEY = 500
;Setting the time
DAY = 10
TIME = 1
;Game start
PRINT What do we do now?

; Also CORRECT in Emuera
; The ; at the end of MONEY = 500 is not needed
; MISTAKE in eramaker

MONEY = 500;
TIME = 5; (Start on Day 5)


Half-width input

Please use half-width characters when inputting numbers, instructions, variable names, function names, etc.

; CORRECT

MONEY = 500
PRINT Let the game begin.

; MISTAKE

MONEY = 500
PRINT Let the game begin.

Inputting a string

It doesn't work properly if you enclose a string with "".

; CORRECT

PRINT The day is over...

; MISTAKE

PRINT "The day is over..."

It' s all in one line

Even when writing long instructions, don't split them into more than two lines.

; CORRECT

PRINT Nayuki's body was sensitive and she had a lot of experience, so she was happy even if it was a little rough. Even though she denies it with her mouth, Nayuki is getting more and more promiscuous. But the peculiar circumstance of her being asleep made me hesitant to make a bolder move.

; MISTAKE

PRINT 
Nayuki's body was sensitive and she had a lot of experience, so she was happy even if it was a little rough. Even though she denies it with her mouth, Nayuki is getting more and more promiscuous. But the peculiar circumstance of her being asleep made me hesitant to make a bolder move.

Variables and Instructions

About the variables

In training SLG, the change of parameters is vital. Therefore, it is necessary to learn how to use "variables" that can store data and perform calculations such as adding and multiplying data.

Putting a number in a variable

Use = (equal). Please enter it in half-width characters. Before and after = is separated by a half-size space or a tab.
The numbers that can be used in eramaker are basically integers. Do not enter a decimal point.*

; CORRECT

MONEY = 500

; MISTAKE

MONEY = 500
MONEY=500
MONEY = 3.14

*Adendum: Emuera has since added more number literal types. Check Constants (Literals) for more information.

Putting a calculated number into a variable

Use = in the same way. Note that * is for multiplication, / is for division, and % is for the rest of the division.
Fractions are rounded down when the result is a decimal.

; CORRECT

;set MONEY to 74
MONEY = 15+34+25
;set MONEY to 650
MONEY = 150+(100-50)*10
;set MONEY to 3
MONEY = 10/3
;set MONEY to TIME multiplied by 10
MONEY = TIME*10
;If DAY is 0,1,2... then MONEY becomes 0,10,20... and returns to 0 when it exceeds 7.
MONEY = DAY%7*10

; MISTAKE

MONEY = 500×10÷4

Add or multiply variables

Use +=, -=, *=, /=, %=.

; EXAMPLE

MONEY = 100
TIME = 12
;set MONEY to 150
MONEY += 50
;set MONEY to 750
MONEY *= 7-2
;set MONEY to 80
MONEY -= 670
;set MONEY to 8
MONEY %= TIME
;set MONEY to 1
MONEY /= TIME-4

About Arrays

  • The variables can be accessed as an "array". An "array" is for managing multiple data with the variable of the same name.
  • To access the array, use : (colon). Please enter it in half-width characters. Don't put any spaces in between.
  • The number that can be put after the array is at least 0. The maximum value is determined by the variable. See the list for more information.
  • You can also put a variable instead of a number after the array. However, you can't put an array after an array.
; CORRECT

A = 35
;Set the FLAG to a value
FLAG:0 = 0
FLAG:2 = 10
FLAG:35 = 440
;Calculate with FLAG
FLAG:A += 100/FLAG:2
FLAG:2 *= FLAG:A

; MISTAKE

FLAG:0 = 10
FLAG : 52 = 1000
FLAG:FLAG:20 = 10000
FLAG:91881816 = 1

About the Double Sequence

  • Exceptionally, some variables can be accessed using two colons. Usually variables related to your character's data.
  • Use (variable name):(character number):(variable number) to access it.
; EXAMPLE

A = 2
;Makes the 5th character's 0th ability LV3.
ABL:5:0 = 3
;A (2nd) character's first experience is increased by 1.
EXP:A:1 += 1


Display the variable on the screen

  • The easiest way to do this is to use the PRINTV and PRINTVL commands. We will discuss the instruction in more detail later.
; EXAMPLE

A = 2
PRINTV A
A = 30
PRINTVL A
B = 400
PRINTVL B

; RESULTS

230
400

About String Variables

  • Regular variables can only handle integers, but there are string variables that can handle strings. However, the features are limited.
  • To display a string variable on the screen, use the PRINTS or PRINTSL instruction.
; CORRECT

STR:0 = aiueo
PRINTSL STR:0

; MISTAKE

;You can't add it with +=
STR:0 += ueo


Variable List

About Instructions (Basic)

Instructions can be used to display characters on the screen and to make conditional judgments.

How to write an instruction

  • The basic writing style is (instruction name) (instruction content). Separate (instruction name) and (instruction content) with a half-size space or tab.
  • If there is no (instruction content), start a new line as it is.
; CORRECT

PRINT This is a test.
SIF 3 == 1+2
   PRINT Obviously.
WAIT

; MISTAKE

PRINTThis is a test.。
;wait for input
WAIT 0

Displaying Text

  • PRINT is an instruction to display text; PRINTL displays text and starts a new line; PRINTW displays text and waits for input.
  • The PRINTV command displays the content of a variable, the PRINTVL command displays the content of the variable and makes a new line, the PRINTVW command displays the content of the variable and waits for input.
  • PRINTS is an instruction that displays the contents of a string variable, PRINTSL displays the contents of the string variable and starts a new line, PRINTSW displays the contents of the string variable and waits for input, and PRINTSW displays the contents of the string variable and waits for input.
  • PRINTFORM can display a combination of characters, variables, and string variables; PRINTFORML can do the same and break a new line; PRINTFORMW can do the same and wait for input.
  • PRINTFORMS is the same as PRINTFORM. PRINTFORMSL is the same as PRINTFORM, but with a new line, PRINTFORMSW is the same as PRINTFORM and waits for input.

(If you are waiting for input with a W at the end of the command, press Enter to move on, and the line will eventually be broken.

; EXAMPLE

MONEY = 500
NAME:0 = Sato
PRINT The money is 
PRINTV MONEY
PRINTL  yen.
PRINT My name is 
PRINTS NAME:0
PRINTL .
PRINTFORML To repeat, the name is %NAME:0% and the money is {MONEY} yen.
PRINTFORMW If you get 1000 yen and pay 600 yen, you're left with {MONEY+1000-600} yen.
STR:0 = If you multiply that money by five, it's {(MONEY+1000-600)*5} yen.
PRINTFORMSW STR:0

; RESULTS

The money is 500 yen.
My name is Sato.
To repeat, the name is Sato and the money is 500 yen.
If you get 1000 yen and pay 600 yen, you're left with 900 yen.
If you multiply that money by five, it's 4500 yen.

条件判断する

  • 条件判断は; EXAMPLEを見ながら理解するのが早
  • SIFは条件式が0でなければ(成立した場合)次の行を実行します。0の場合(成立しない場合)、次の行をスキップします。
  • IFは条件式が0でなければ(成立した場合)、次の行からELSE、ELSEIF、ENDIFを迎えるまで実行していきます。0である場合(成立しない場合)、ELSE、ELSEIF、ENDIFを迎えるまでスキップします。(ELSEならその次の行からENDIFを迎えるまで実行します。ELSEIFで条件式が成立している場合、その次の行からELSEかELSEIFかENDIFを迎えるまで実行します。成立していなければELSEかELSEIFかENDIFを迎えるまでスキップし、同じことを繰り返します)
; EXAMPLE

A = 1
B = 2
C = 4

SIF A == 1
   PRINTL テスト1
SIF B != 1
   PRINTL テスト2
SIF C < 5
   PRINTL テスト3
IF A+B > 2
   IF C >= 6
      PRINTL テスト4
   ELSE
      PRINTL テスト5
   ENDIF
   IF A == 1 && B == 3
      PRINTL テスト6
   ELSEIF A == 1 || B == 3
      PRINTL テスト7
   ELSEIF A > 1 || (B > 2 && C > 2)
      PRINTL テスト8
   ENDIF
ELSEIF A+B == 2
   PRINTL テスト9
ELSE
   PRINTL テスト10
ENDIF

; RESULTS

テスト1
テスト2
テスト3
テスト5
テスト7
  • 「等しい」には==を、「等しくない」には!=を、「左が大きい」には>を、「左が右以上」には>=を、「右が大きい」には<を、「右が左以上」には<=を使います。すべて半角で入力してください。
  • 「かつ」には&&を、「または」には||を使います。すべて半角で入力してください。
  • カッコを使い、複雑な条件を記述することもできます。

入力と入力待ち

  • 文章を表示するなどして、入力を待つときにはWAITを使います。

(※普段はPRINTWなどを使うと、少ない行数で表現できるため見やすいです)

  • 整数をプレイヤーに入力させたいときはINPUTを使います。入力された結果はRESULTに格納されます。
  • 文字列をプレイヤーに入力させたいときはINPUTSを使います。入力された結果はRESULTSに格納されます。
; EXAMPLE

PRINT データ入力開始。
WAIT
PRINTL 年齢を入力してください。
INPUT
PRINTL 名前を入力してください。
INPUTS
PRINTFORML %RESULTS%さんは{RESULT}歳ですね。

繰り返しとGOTO

  • 同じ命令を繰り返したいときはREPEATを使います。RENDがあるまで繰り返されます。繰り返した回数はCOUNTに格納されます。
  • REPEATの中にREPEATは作れませんので注意してください。
  • REPEATからRENDまでの途中でCONTINUEを使うと、REPEATのあるところまで戻ります。BREAKを使うと、繰り返しをやめてRENDの次の行までスキップします。
  • 別のところに一気に移動したいときはGOTOを使います。GOTOを使うときは、$を使って「ラベル」を登録しておく必要があります。
; Example 1

REPEAT 10
   PRINT あいう
REND
;0文字をPRINTLで書くことで改行
PRINTL 
REPEAT 5
   PRINTFORML 点数:{COUNT*5}
REND

; Results Of Example 1

あいうあいうあいうあいうあいうあいうあいうあいうあいうあいう
点数:0
点数:5
点数:10
点数:15
点数:20

; Example 2

MONEY = 300
REPEAT 5
   SIF MONEY <= COUNT*100
      BREAK
   PRINTFORML {COUNT*100}円よりは金が多い。
REND
REPEAT 5
   SIF MONEY == COUNT*100
      CONTINUE
   PRINTFORML 所持金は{COUNT*100}円ではない。
REND

; Results Of Example 2

0円よりは金が多い。
100円よりは金が多い。
200円よりは金が多い。
所持金は0円ではない。
所持金は100円ではない。
所持金は200円ではない。
所持金は400円ではない。

; Example 3

$INPUT_LOOP
PRINTL 0から9までの数字を入力してください。
INPUT
SIF RESULT < 0 || RESULT > 9
   GOTO INPUT_LOOP
PRINTFORML {RESULT}が入力されました。

関数について

  • プログラムを最初から最後まで続けて書くとわかりづらいものです。
  • 部分部分に切り分けてわかりやすくするためには、「関数」を使います。
  • 関数は@を使って登録します。@の後に、アルファベットと_(アンダーバー)を使って関数名を書いてください。関数名は半角で入力してください。
  • ゲームの最初に呼ばれる関数は「EVENTFIRST」という名前にします(これについては後に詳述)。
  • 他の関数に移動するには、JUMPを使います。
  • 他の関数に移動し、その関数が終わったら再び元の位置から再開したいときはCALLを使います。
  • CALLで呼ばれた関数の中でRETURNを使うと、その関数を途中で終えることができます。そのとき、RESULTにRETURNで指定した数値が格納されます。RETURNを使わずに関数が終了した場合、RESULTには0が格納されます。
  • RESTARTを使うと、その関数の最初からやり直します。
; EXAMPLE

@EVENTFIRST
PRINTW ゲームスタート。

CALL OPENING
PRINTFORMW オープニングの結果は{RESULT}でした。
CALL GAME_MAIN
PRINTFORMW ゲームの結果は{RESULT}でした。
JUMP ENDING

PRINTL JUMPしたのでこの部分は表示されない。

@OPENING
PRINTW オープニングです。
RETURN 25

@GAME_MAIN
PRINTW ゲーム中です。
PRINTL RETURNなしで終わります。

@ENDING
PRINTW エンディングです。
RESTART

; RESULTS

ゲームスタート。
オープニングです。
オープニングの結果は25でした。
ゲーム中です。
RETURNなしで終わります。
ゲームの結果は0でした。
エンディングです。
エンディングです。
エンディングです。
エンディングです。
エンディングです。
.......(以下無限)

その他、基本的な命令

  • QUITを使うとゲームを終了します。
  • DRAWLINEを使うと画面の左端から右端まで----と線を引きます。
  • TIMESを使うと、小数を使った掛け算ができます。eramakerでは基本的に数値を整数で扱うので、小数を絡めたいときはこの命令を使ってください。TIMES (変数) , (小数値)という形で使います。
  • BARを使うと、[*****....]のようにグラフが表示できます。BARLの場合は改行されます。BAR (変数) , (最大値), (長さ)という形で使います。
; EXAMPLE

MONEY = 500
DRAWLINE
BARL MONEY , 1000 , 20
PRINTFORMW {MONEY}円持っていました。
DRAWLINE
TIMES MONEY , 1.25
BARL MONEY , 1000 , 20
PRINTFORMW {MONEY}円になりました。ゲームを終了します。
QUIT

; RESULTS

---------------------------------------------------------------------
[**********..........]
500円持っていました。
---------------------------------------------------------------------
[************........]
625円になりました。ゲームを終了します。


命令について(調教用)

  • eramakerには、調教のために使う特殊な命令がいくつかあります。

調教用データの表示

  • PRINT_ABLはキャラの能力を表示します。
  • PRINT_TALENTはキャラの素質を表示します。
  • PRINT_MARKはキャラの刻印を表示します。
  • PRINT_EXPはキャラの経験を表示します。
  • PRINT_PALAMはキャラの調教中パラメータを表示します。
  • 以上の命令を使うときには、どのキャラのデータを表示したいのかを指定してください。たとえばPRINT_ABL 0なら、大体の場合は主人公の能力を表示することになります。


  • PRINT_ITEMは所持しているアイテムを表示します。
  • PRINT_SHOPITEMはショップで売っているアイテムを表示します。


  • UPCHECKは調教コマンドによる調教中パラメータの変化を表示します。


キャラの管理

  • ADDCHARAはキャラを追加します。キャラ番号3のキャラを追加したいならADDCHARA 3のようにします。
  • ADDSPCHARAはSPキャラを追加します。キャラ番号3のSPキャラを追加したいならADDSPCHARA 3のようにします。

(SPキャラとは、キャラフラグの0番が1であるキャラのことを指します)

  • DELCHARAはADDCHARAなどで追加したキャラを削除します。
; EXAMPLE

;キャラ番号0のキャラの名前が浩之で主人公。
;キャラ番号3のキャラの名前が智子、5のキャラの名前がレミィ、6のキャラの名前が琴音だとする
PRINTFORML 今いるキャラは{CHARANUM}人です。

ADDCHARA 3
ADDCHARA 5
ADDCHARA 6
PRINTFORML 今いるキャラは{CHARANUM}人です。
REPEAT CHARANUM
   PRINTFORML {COUNT}番目に%NAME:COUNT%。
REND
DELCHARA 2
PRINTFORML 今いるキャラは{CHARANUM}人です。
REPEAT CHARANUM
   PRINTFORML {COUNT}番目に%NAME:COUNT%。
REND

; RESULTS

今いるキャラは1人です。
今いるキャラは4人です。
0番目に浩之。
1番目に智子。
2番目にレミィ。
3番目に琴音。
今いるキャラは3人です。
0番目に浩之。
1番目に智子。
2番目に琴音。

セーブ関係

  • SAVEGAMEはセーブ画面を、LOADGAMEはロード画面を呼びます。いずれもSHOPでないと呼び出せません。
  • PUTFORMは@SAVEINFOという特殊な関数でのみ使えます。PRINTFORMと同様の書式で書くことにより、セーブデータに概要をつけることができます。何日目か、キャラの能力はどれくらいか、どのキャラを調教しているかなどのデータを書き込むとよいでしょう。

BEGIN

  • BEGINはさまざまなシステム命令を呼び出すことにより、ゲームを進行させます。
  • BEGINを呼んだ時点で実行中の関数は終了します。CALLでどこからか呼ばれてきたとしても、元の関数に戻ることはありません。


  • BEGIN TRAINは調教を開始します。
  • BEGIN AFTERTRAINは調教を終了します。
  • BEGIN ABLUPは能力アップ画面を呼び出します。
  • BEGIN TURNENDはそのターンを終了します。
  • BEGIN SHOPはSHOPを呼び出します。


更新履歴

  • 06/05/05 暫定版公開。