翔鹰帝国网|帝国时代论坛|帝国时代系列|神话时代
 找回密码
 注册翔鹰会员(昵称)
搜索
查看: 396|回复: 2

[交流讨论] 从程序中提取的触发XS函数说明

[复制链接]

417

主题

19

精华

8万

积分

教皇

耕战
13421
鹰币
41665
天龙币
18
回帖
6009

特级嘉禾勋章三级帝国勋章十字军勋章翔鹰建站十周年纪念章

附庸关系0
 楼主| 发表于 2020-11-29 00:28:59 | 显示全部楼层 |阅读模式
上个星期的更新中,游戏增加了一些触发,还允许制作者编写XS脚本,然后在触发中调用自己创作的条件或效果。我在更新游戏后也于第一时间尝试了脚本功能,但是无论我在游戏目录中如何寻找,都找不到常量以外的关于XS的内容。后来又尝试用十六进制编辑器打开程序文件,在其中发现了一些字符串,看样子应该是XS脚本的信息。

通过这些内容我发现,除了一些基本的数学运算和数据类型存取,就只有少数几个能改变游戏内容的函数了。这与我所预想的有很大差距,譬如最常用的单位属性就没有对应的函数。如果这就是全部内容的话,那么XS脚本能做的事情就太少了,只能存取变量和玩家的资源值,或者像ETP一样送出有数字的聊天。莫非还有其它函数,或者是通过调用xsAddRuntimeEvent和xsGetFuntionID来实现更多功能?
以下为提取的内容,包括了函数定义及其功能解释。

void xsDisableRule( string ruleName ): Disables the given rule.
void xsDisableSelf( void ): Disables the current rule.
void xsEnableRule( string ruleName ): Enables the given rule.
bool xsIsRuleEnabled( string ruleName ): Returns true if the rule is enabled.
void xsSetRulePriority( string ruleName, int priority ): Sets the priority of the given rule.
void xsSetRulePrioritySelf( int priority ): Sets the priority of the current rule.
void xsSetRuleMinInterval( string ruleName, int interval ): Sets the min interval of the given rule.
void xsSetRuleMinIntervalSelf( int interval ): Sets the min interval of the current rule.
void xsSetRuleMaxInterval( string ruleName, int interval ): Sets the max interval of the given rule.
void xsSetRuleMaxIntervalSelf( int interval ): Sets the max interval of the current rule.
void xsEnableRuleGroup( string ruleGroupName ): Enables all rule in the given rule group.
void xsDisableRuleGroup( string ruleGroupName ): Disables all rules in the given rule group.
void xsIsRuleGroupEnabled( string ruleGroupName ): Returns true if the rule group is enabled.
float xsVectorGetX( vector v ): Returns the x.ocmponent of the given vector.
float xsVectorGetY( vector v ): Returns the y component of the given vector.
float xsVectorGetZ( vector v ): Returns the z component of the given vector.
float xsVectorSetX( vector v, float x ): Set the x.ocmponent of the given vector, returns the new vector.
float xsVectorSetY( vector v, float y ): Set the y component of the given vector, returns the new vector.
float xsVectorSetZ( vector v, float z ): Set the z component of the given vector, returns the new vector.
float xsVectorSet( float x, float y, float z ): Set the 3 components into a vector, returns the new vector.
float xsVectorLength( vector v ): Returns the length of the given vector.
float xsVectorNormalize( vector v): Returns the normalized version of the given vector.
int xsArrayCreateInt(int size, int defaultValue, string name): creates a sized and named integer array, returning an arrayID.
int xsArraySetInt(int arrayID, int index, int value): Sets a value at the specified index in the requested array.
int xsArrayGetInt(int arrayID, int index): Gets the value at the specified index in the requested array.
int xsArrayResizeInt(int arrayID, int newSize): Resize the requested array.
int xsArrayCreateFloat(int size, float defaultValue, string name): creates a sized and named float array, returning an arrayID.
int xsArraySetFloat(int arrayID, int index, float value): Sets a value at the specified index in the requested array.
float xsArrayGetFloat(int arrayID, int index): Gets the value at the specified index in the requested array.
int xsArrayResizeFloat(int arrayID, int newSize): Resize the requested array.
int xsArrayCreateBool(int size, bool defaultValue, string name): creates a sized and named boolean array, returning an arrayID.
int xsArraySetBool(int arrayID, int index, bool value): Sets a value at the specified index in the requested array.
bool xsArrayGetInt(int arrayID, int index): Gets the value at the specified index in the requested array.
int xsArrayResizeBool(int arrayID, int newSize): Resize the requested array.
int xsArrayCreateString(int size, string defaultValue, string name): creates a sized and named string array, returning an arrayID.
int xsArraySetString(int arrayID, int index, string value): Sets a value at the specified index in the requested array.
string xsArrayGetString(int arrayID, int index): Gets the value at the specified index in the requested array.
int xsArrayResizeString(int arrayID, int newSize): Resize the requested array.
int xsArrayCreateVector(int size, vector defaultValue, string name): creates a sized and named vector array, returning an arrayID.
int xsArraySetVector(int arrayID, int index, vector value): Sets a value at the specified index in the requested array.
vector xsArrayGetVector(int arrayID, int index): Gets the value at the specified index in the requested array.
int xsArrayResizeVector(int arrayID, int newSize): Resize the requested array.
int xsArrayGetSize(int arrayID): Gets the specified array's size.
int xsDumpArrays(): blogs out all XS arrays.
int xsGetContextPlayer( void ): Returns the current context player ID.
void xsSetContextPlayer( int playerID ): Sets the current context player ID (DO NOT DO THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING).
int xsGetTime( void ): Returns the current gametime (in milliseconds).
bool xsAddRuntimeEvent( string foo, string bar, int something ): Setups a runtime event.  Don't use this.
int xsGetFuntionID( string functionName ): Runs the secret XSFID for the function. USE WITH CAUTION.
float abs(float x)
float sqrt(float x)
float pow(float x, float y)
float sin(float x)
float cos(float x)
float tan(float x)
float asin(float x)
float acos(float x)
float atan(float x)
float atan2(float x)
long xsTriggerVariable(long x)
void xsSetTriggerVariable(long x, long value)
float xsPlayerAttribute(long playerId, long attribute)
float xsSetPlayerAttribute(long playerId, long attribute, float value)
xsChatData(const char* text, long value);


评分

参与人数 1耕战 +80 鹰币 +240 收起 理由
newtonerdai + 80 + 240 XS脚本文档提取

查看全部评分

004时代:战役时代
我很乐意看到有人在MOD技术上超过我。
回复

使用道具 举报

183

主题

9

精华

2万

积分

教皇

耕战
3325
鹰币
14951
天龙币
0
回帖
1200

翔鹰建站十周年纪念章

附庸关系3
发表于 2020-12-2 18:01:18 | 显示全部楼层
卧槽,这么多的吗。看来又有得翻译了
索引:
Userpatch 实用技术贴索引←点击进入
决定版精品贴大索引←点击进入

战役:
《 兔与豹》——柔弱奴隶公主  猛兽口中求生←点击进入
《敛由国的统一》←点击进入

殊途战役制作群 QQ: 616317226
翔鹰帝国Ⅱ:决定版交流群 QQ: 112822759
回复

使用道具 举报

53

主题

3

精华

5万

积分

征服者

耕战
9409
鹰币
5926
天龙币
0
回帖
475

翔鹰建站十周年纪念章一级翔鹰勋章雄鹰勋章第三届战鹰杯单人赛冠军识货者第七届火箭筒杯优秀战役第七届火箭筒杯最佳新人

附庸关系0
发表于 2020-12-8 14:07:17 | 显示全部楼层
創建和存取數組的函數比較多而已,其實都是些基本數據處理用的函數。
我隨意中文化了一些:

規則相關:(我不清楚這是用來幹什麼的)
void xsDisableRule( string ruleName ): 禁用給定規則。
void xsDisableSelf( void ): 禁用當前規則。
void xsEnableRule( string ruleName ): 啟用給定規則。
bool xsIsRuleEnabled( string ruleName ): 如果啟用了規則,則返回true。
void xsSetRulePriority( string ruleName, int priority ): 設置給定規則的優先級。
void xsSetRulePrioritySelf( int priority ): 設置當前規則的優先級。
void xsSetRuleMinInterval( string ruleName, int interval ): 設置給定規則的最小間隔。
void xsSetRuleMinIntervalSelf( int interval ): 設置當前規則的最小間隔。
void xsSetRuleMaxInterval( string ruleName, int interval ): 設置給定規則的最大間隔。
void xsSetRuleMaxIntervalSelf( int interval ): 設置當前規則的最大間隔。
void xsEnableRuleGroup( string ruleGroupName ): 啟用給定規則組中的所有規則。
void xsDisableRuleGroup( string ruleGroupName ): 禁用給定規則組中的所有規則。
void xsIsRuleGroupEnabled( string ruleGroupName ): 如果啟用了規則組,則返回true。

向量處理相關:
float xsVectorGetX( vector v ): 回傳該向量的x 值
float xsVectorGetY( vector v ): 回傳該向量的y 值
float xsVectorGetZ( vector v ): 回傳該向量的z 值
float xsVectorSetX( vector v, float x ): 設置該向量的x 值,並回傳新向量
float xsVectorSetY( vector v, float y ): 設置該向量的y 值,並回傳新向量
float xsVectorSetZ( vector v, float z ): 設置該向量的z 值,並回傳新向量
float xsVectorSet( float x, float y, float z ): 將x, y, z 3個數值設置為向量,並回傳新向量。
float xsVectorLength( vector v ): 返回給定向量的長度。
float xsVectorNormalize( vector v): 返回給定向量的 normalized(方向不變,但長度為1)

數組處理相關:
整數數組(int array)
int xsArrayCreateInt(int size, int defaultValue, string name): 創建一個有名字和固定size的整數數組(int array),回傳arrayID
int xsArraySetInt(int arrayID, int index, int value): 設置數組中index位置的數值
int xsArrayGetInt(int arrayID, int index): 回傳數組中index位置的數值
int xsArrayResizeInt(int arrayID, int newSize): 重新定義數組的size
浮點數數組(float array)
int xsArrayCreateFloat(int size, float defaultValue, string name): 創建一個有名字和固定size的浮點數數組,回傳arrayID
int xsArraySetFloat(int arrayID, int index, float value): 設置數組中index位置的數值
float xsArrayGetFloat(int arrayID, int index): 回傳數組中index位置的數值
int xsArrayResizeFloat(int arrayID, int newSize): 重新定義數組的size
布林數組(boolean array)
int xsArrayCreateBool(int size, bool defaultValue, string name): 創建一個有名字和固定size的布林數組,回傳arrayID
int xsArraySetBool(int arrayID, int index, bool value): 設置數組中index位置的數值
bool xsArrayGetInt(int arrayID, int index): 回傳數組中index位置的數值
int xsArrayResizeBool(int arrayID, int newSize): 重新定義數組的size
字串數組(string array)
int xsArrayCreateString(int size, string defaultValue, string name): 創建一個有名字和固定size的字串數組,回傳arrayID
int xsArraySetString(int arrayID, int index, string value): 設置數組中index位置的數值
string xsArrayGetString(int arrayID, int index): 回傳數組中index位置的數值
int xsArrayResizeString(int arrayID, int newSize): 重新定義數組的size
向量數組(vector array)
int xsArrayCreateVector(int size, vector defaultValue, string name): 創建一個有名字和固定size的向量數組,回傳arrayID
int xsArraySetVector(int arrayID, int index, vector value): 設置數組中index位置的數值
vector xsArrayGetVector(int arrayID, int index): 回傳數組中index位置的數值
int xsArrayResizeVector(int arrayID, int newSize): 重新定義數組的size

int xsArrayGetSize(int arrayID): 回傳數組的size
int xsDumpArrays(): blogs out all XS arrays.

其他:
int xsGetContextPlayer( void ): Returns the current context player ID.
void xsSetContextPlayer( int playerID ): Sets the current context player ID (DO NOT DO THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING).
int xsGetTime( void ): 返回當前遊戲時間(以毫秒為單位)
bool xsAddRuntimeEvent( string foo, string bar, int something ): Setups a runtime event.  Don't use this.
int xsGetFuntionID( string functionName ): Runs the secret XSFID for the function. USE WITH CAUTION.

數學算式:
float abs(float x)
float sqrt(float x)
float pow(float x, float y)
float sin(float x)
float cos(float x)
float tan(float x)
float asin(float x)
float acos(float x)
float atan(float x)
float atan2(float x)

場景觸發相關:
long xsTriggerVariable(long x): 回傳"觸發變數"的數值
void xsSetTriggerVariable(long x, long value): 設置"觸發變數"的數值
float xsPlayerAttribute(long playerId, long attribute): 回傳玩家的資源數值
float xsSetPlayerAttribute(long playerId, long attribute, float value): 設置玩家的資源數值
xsChatData(const char* text, long value);  發送帶有所需消息/變量的聊天。 這對於測試很有用。


回复

使用道具 举报

本版积分规则

排行榜|小黑屋|翔鹰帝国

GMT+8, 2024-3-29 03:23 , Processed in 0.099495 second(s), 47 queries , File On.

Powered by Hawk Studio  QS Security Corp.® Licensed

Copyright © 2001-2023, Hawkaoe.net All Rights Reserved

快速回复 返回顶部 返回列表