これらの文法及び文章は wiki.garrysmod.com より意訳及び直訳翻訳したものです。
日本語が変であれば編集をよろしくお願いします(´・ω・`)ノ
('A`)多分間違ってると思うけど確実に。
オワタにPropCoreが入ったようです。やったね!
Features[特徴]
Syntax[構文]
Wire Expression2に慣れるには、多少時間が掛かります。そして、
これらのWire Expression2は君の表現力と技術力を取得できます。
発想次第で様々なタスクが実行出来ます。
一部の記号はwikiの仕様上の理由や見やすくするために全角で書いてありますが、実際に書くときは半角で書かないといけません。
それ以前にゲーム内のエディタは半角以外入力できませんが・・・。
構文 | 使用例 | 説明 |
# | #This is a comment | #の後に書いたものがコメントになる。注釈等を書く際に使える。 |
if () {} | if (A) {B = C} | ()の中の条件(この場合はA)を満たしているとき、{}内の処理が実行される。 |
else {} | else {A = B} | ifの条件を満たさなかった場合に実行する処理。これが無くてもifは使えるが、これそのものを単体で使うことはできないので注意。 |
elseif (){} | elseif (A) {B = C} | elseにさらに条件をつけたもの。基本はifと同じだが、単体では使えない。 |
( ? : ) | D = (A ? B : C) | ifを簡略化したもの。ifと同じように使える。 Note: [A ?: B] と [A ? A : B]は同じ |
& | if (A & B) {C = 1} | 条件Aと条件Bの両方を満たしている場合1を返す。 |
| | if(A|B) {C = 1} | 条件Aか条件Bのどちらかを満たしている場合1を返す。 |
! | if(!A) {C = 1} | 条件Aを満たしていなかった場合1を返す。 |
++ | A++ | Aに一を足す。よく使われるので覚えておくといいかも。 |
-- | A-- | Aから一を引く。上と同じくよく使われるので覚えておくといいかも。 |
Variables[変数]
例:Wire Exprresion2では、すべての変数が大文字で始まる必要があります。
@inputs 外部からの入力に使う変数を宣言する場合に使う。 @outputs 外部への出力に使う変数を宣言する場合に使う。 @persist 内部での処理にのみ使う変数を宣言する場合に使う。
@trigger-directive[トリガディレクティブ]
トリガディレクティブは実行をすることができますトリガを選択入力から無効にするか有効にします。使用可能な値は、ですが、すべての/なし、リストの入力も
@trigger all # old behaviour, inputs always trigger executions @trigger none # will never trigger from inputs, only timers, etc @trigger Time Button # will only trigger if Time or Button has changed
@model-directive[モデルディレクティブ]
モデルのパス(models/props_phx/construct/metal_plate1.mdl等)を入力することで、Exp2のチップを任意のモデルへ変えることができる。
@model *model path*
Loops[ループ]
Wire Exprresion2は、ループの1つのタイプ:whileループを備えています。
Tこれらの手順は、1つの実行ではなく、
複数の執行の繰り返しタスクを実行するに頼るよりも何度も繰り返されることができます。
Syntax | Example | 説明 |
while () {} | while (A) {B++} | 条件Aがtrueの間、{}内の処理を実行する。条件を満たさなかった場合、ループから抜ける。 |
for () {} | for (I = A, B, C) {D++} | Iが条件Bを満たしている間、{}の処理を実行する。AはIの初期値。CはIに変化を加えるためのものなので、省略可能。省略した場合、自動的に一を足す処理になる。 |
continue | if (A) {continue} | ループ内でのみ使用可能。条件の正否にかかわらず、ループを実行する。 |
break | if (A) {break} | ループ内でのみ使用可能。条件の成否にかかわらず、ループを中断する。 |
Performance[パフォーマンス]
Garry's Modのモジュールでいくつかのパフォーマンステストを確認:
3.000.000/s arithmetic operations (+-*/) on numbers, 2000 ops, 200 executions in 0.13s
850.000/s arithmetic operations (+-*/) on vectors, 2000 ops, 100 executions in 0.23s
Wire Exprresion2は、多くのことができますが、クォータの遅れからサーバーを防ぐためにしています。
オプスダニの使用量は ティッククォータを超える場合、式はシャットダウンします。
すべての目盛りは、オプスはsofマイナスカウンタには、
その場合、カウンタ ハードクォータを超える追加されて使用し、式はシャットダウンします。
このような変数で一般的に使用される値を格納するようにコーディングを学ぶお勧めします。
ショートカット | 説明 |
Ctrl-Space | 検証(エラー箇所にカーソルを移動) |
Ctrl-S | 保存 |
Ctrl-Q | 閉じる |
Ctrl-Z | 元に戻す |
Ctrl-Y | やり直す |
Ctrl-X | 切り取り |
Ctrl-C | コピー |
Ctrl-V | 貼り付け |
Ctrl-A | 全て選択 |
Ctrl-I/Tab | インデント |
Ctrl-O/Shift-Tab | アウトデント |
Ctrl-K | 選択したブロックをコメントアウト |
Ctrl-Shift-K | 選択したブロックをアンコメント |
Ctrl-F | 検索 |
Ctrl-H | 置換 |
Ctrl-Up | スクロール アップ |
Ctrl-Down | スクロール ダウン |
Ctrl-Left | 左の行に移動 |
Ctrl-Right | 右の行に移動 |
Ctrl-Home | 最初の行に移動 |
Ctrl-End | 最後の行に移動 |
Console Commands[コンソールコマンド]
コマンド | 説明 |
wire_expression2_model <model> | 手動でモデルを変更します。 |
wire_expression2_reload | 独自の拡張機能をデバッグするためリロードすべてのE2の拡張子、便利です。 Keep in mind that client-side files will be taken from gmod's cache in multi-player mode.念頭に置いてクライアント側のファイルは、マルチプレイヤーモードのgmodのキャッシュから取得されることをしてください。 |
wire_expression2_debug 0/1 | 便利な開発者のためかもしれない情報を示しています切り替えますデバッグモードでは、この場合、変更後に"wire_expression2_reload"を行うには何の効果を持っている必要があります。 |
Datatypes(データ型)
Wire Exprresion2は、いくつかのデータ型を使用して我々はこれらのデータ型の省略形を使用して合理的なサイズでwikiを保つために、ここではすべて省略表記を使用のリストとそれが表すデータ型です。
Shorthand | データ型 |
番号 | |
2D / 3D / 4D Vector(ベクトル) | |
角度 | |
文字列 | |
エンティティ | |
配列 | |
テーブル | |
レンジャーデータ | |
骨 | |
2x2 / 3x3 / 4x4 Matrix(行列) | |
ワイヤーリンク | |
複素数 | |
四元数 |
Number
説明
多くの番号の..
命令
Function | Returns | Description |
N + N | 加算(足し算) | |
N - N | 減算(引き算) | |
N * N | 乗算(かけ算) | |
N / N | 除算(割り算) | |
N ^ N | べき乗(累乗) | |
N % N | 剰余(余り) | |
mod(N, N) | 上と同じ | |
sqrt(N) | Nの平方根を返す | |
cbrt(N) | Nの立方根を返す | |
root(N, N) | 1番目の引数のN乗根を返す | |
e() | オイラーの定数を返す | |
exp(N) | e()^Nを返す (e()^Nと直接書いても結果は同じだけど、こっちのほうが処理が早い) | |
ln(N) | e()を底とするNの対数を返す | |
log2(N) | 2を底とするNの対数を返す | |
log10(N) | 10を底とするNの対数を返す | |
log(N,N) | [引数2]を底とする[引数1]の対数を返す | |
abs(N) | Nの絶対値を返す | |
ceil(N) | Nを切り上げた整数を返す | |
ceil(N,N) | [引数1]を小数点第[引数2]位で切り上げた数値を返す | |
floor(N) | Nを切り捨てた整数を返す | |
floor(N,N) | [引数1]を小数点第[引数2]位で切り捨てた数値を返す | |
round(N) | 引数を四捨五入した整数を返す | |
round(N,N) | [引数1]を小数点第[引数2]位で四捨五入した数値を返す | |
int(N) | Nの整数部を返す (floor(N)と同じ) | |
frac(N) | Nの小数部を返す (N - floor(N)と同じ) | |
clamp(N,N,N) | [引数1]の値を[引数2]~[引数3]の範囲に丸め込む If Arg1 <= Arg2 (min) returns Arg2; If Arg1 >= Arg3 (max) returns Arg3; otherwise returns Arg1. | |
inrange(N,N2,N3) | Nの値がN2~N3の間だったら1を返す。 それ以外は0。((N2 <= N) & (N <= N3)とだいたい同じ) Returns 1 if N is in the interval [N2; N3], 0 otherwise. This means it is equivalent to ((N2 <= N) & (N <= N3)) | |
sign(N) | Nの符号部(-1,0,1)を返す (sign(N) = N / abs(N)と同じ) | |
min(N,N) | Returns the lowest value Argument | |
min(N,N,N) | Returns the lowest value Argument | |
min(N,N,N,N) | Returns the lowest value Argument | |
max(N,N) | Returns the highest value Argument | |
max(N,N,N) | Returns the highest value Argument | |
max(N,N,N,N) | Returns the highest value Argument | |
random() | Returns a random floating-point number between 0 and 1 [0 <= x < 1 ] | |
random(N) | Returns a random floating-point number between 0 and the specified value [0 <= x < a ] | |
random(N,N) | Returns a random floating-point number between the specified interval [a <= x < b ] | |
randint(N) | Returns a random integer from 1 to the specified value [1 <= x <= a ] | |
randint(N,N) | Returns a random integer in the specified interval [a <= x <= b ] | |
pi() | Returns the constant PI | |
toRad(N) | Converts Degree angles to Radian angles | |
toDeg(N) | Converts Radian angles to Degree angles | |
sin(N) | Returns the sine of N degrees | |
cos(N) | Returns the cosine of N degrees | |
tan(N) | Returns the tangent of N degrees | |
cot(N) | Returns the cotangent of N degrees | |
sec(N) | Returns the secant of N degrees | |
csc(N) | Returns the cosecant of N degrees | |
asin(N) | Returns the inverse sine of the argument, in degrees | |
acos(N) | Returns the inverse cosine of the argument, in degrees | |
atan(N) | Returns the inverse tangent of the argument, in degrees | |
sinh(N) | Returns the hyperbolic sine of N | |
cosh(N) | Returns the hyperbolic cosine of N | |
tanh(N) | Returns the hyperbolic tangent of N | |
coth(N) | Returns the hyperbolic cotangent of N | |
sech(N) | Returns the hyperbolic secant of N | |
csch(N) | Returns the hyperbolic cosecant of N | |
sinr(N) | Returns the sine of N radians | |
cosr(N) | Returns the cosine of N radians | |
tanr(N) | Returns the tangent of N radians | |
cotr(N) | Returns the cotangent of N radians | |
secr(N) | Returns the secant of N radians | |
cscr(N) | Returns the cosecant of N radians | |
asinr(N) | Returns the inverse sine of the argument, in radians | |
acosr(N) | Returns the inverse cosine of the argument, in radians | |
atanr(N) | Returns the inverse tangent of the argument, in radians | |
atanr(N,N) | Returns the inverse tangent of the arguments (arg1 / arg2), in radians. This function accounts for positive/negative arguments, and arguments at or close to 0 | |
A = B | 代入 (Bの値をAにセット) | |
A++ | 1を加算 (Aに1を加える, "A = (A + 1)"と同じ) | |
A-- | 1を減算 (Aから1を引く, "A = (A - 1)"と同じ) | |
A += B | 加算代入 (AにBを加える, "A = (A + B)"と同じ) | |
A -= B | 減算代入 (AからBを引く, "A = (A - B)"と同じ) | |
A /= B | 除算代入 (AをBで割る, "A = (A / B)"と同じ) | |
A %= B | Assignment using modulo | |
A ^= B | Assignment using exponentiation | |
A == B | 等価 (AがBと等しければ1 それ以外は0を返す =との混同に注意) | |
A != B | 不等価 (AがBと等しくなければ1 それ以外は0を返す) | |
A > B | Returns 1 if A is greater than B | |
A < B | Returns 1 if A is less than B | |
A >= B | Returns 1 if A is greater or equal to B | |
A <= B | Returns 1 if A is less than or equal to B |