Skip to content

Instantly share code, notes, and snippets.

@yaqinking
Created November 21, 2016 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaqinking/eb78d8b63d3ef227ee0c091baefcad53 to your computer and use it in GitHub Desktop.
Save yaqinking/eb78d8b63d3ef227ee0c091baefcad53 to your computer and use it in GitHub Desktop.
KAG/TJS script example 计算传入 macro 的变量值时
[iscript]
/**
* 计算传入 macro 的变量值时
*/
var result = 0;
var xpos = 0;
var xmov = 0;
[endscript]
@macro name=calc_move
@eval exp="xpos=+mp.xpos"
@eval exp="xmov=+mp.xmov"
@eval exp="result=xpos+xmov"
XPos [emb exp="xpos"][r]
XMov [emb exp="xmov"][r]
Result [emb exp="result"][p]
@endmacro
@calc_move xpos=100 xmov=-300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment