- UID
- 51393
- 好友
- 0
- 记录
- 0
- 日志
- 0
- 相册
- 0
- 回帖
- 43
- 主题
- 0
- 分享
- 0
- 精华
- 0
- 积分
- 32
- 阅读权限
- 1
- 注册时间
- 2013-3-17
- 在线时间
- 8 小时
- 最后登录
- 2013-5-15
新手上路
- 威望
- 0 点
- 冒险币
- 63 个
- 贡献值
- 0 点
- 好评度
- 0 点
|
发表于 2013-4-5 05:04:11
|
显示全部楼层
【授人以渔】长篇基础技术介绍——JS 属性文本 [复制链接] nil 18 主题 0 好友 148 积分 侠客 该用户从未签到 发消息 电梯直达楼主 发表于 2013-3-11 18:14:29 |只看该作者 |倒序浏览 一键分享 这篇介绍属性文本,属性 文本 就是带有各种效果的文字 ,比如可以点的,有颜色的,下划线的等等 这篇带图,顺便把上篇各种对话框说明下 按照这里的讲解 http://forum.ragezone.com/f428/a ... tart-finish-643364/ 本帖隐藏的内容 一个不需要指定任何状态的NPC function start() { cm.sendOk("I am an NPC without a status."); cm.dispose(); } 因为不需要状态 直接start 调用就可以 另外一个例子 function start() { cm.sendOk("Here is another example of an NPC without status."); } function action(mode, type, selection) { cm.warp(100000000, 0); cm.gainItem(4001126, 1); cm.sendOk("See? Here, I warped you and gave you an item without using status."); cm.dispose(); } 点了以后,传送,获得物品,再讲话,结束 属性文本 #b = Blue text. 蓝色文本,在这之后的字在没设置其他属性下为蓝色字 如 #b 蓝色字 #c[itemid]# Shows how many [itemid] the player has in their inventory. 显示玩家背包里的道具数量 如 #c1002357# #d = Purple text. 紫色字体 颜色之间一起用以最后一个为准 #e = Bold text. 粗体 如 #b #e 蓝色粗体字 #f[imagelocation]# - Shows an image inside the .wz files. 显示wz文件中的图片指定路径 可以是物品 技能 地图等等 #g = Green text. 绿色字体 #h # - Shows the name of the player. 显示玩家名称 如 [#h#]你好 #i[itemid]# - Shows a picture of the item. 显示 物品 图片 #k = Black text. 黑色子图 #L[number]# Selection open. #l - Selection close. 这两个连用 #L0#这是选项1#l #m[mapid]# - Shows the name of the map. 显示地图名称 #n = Normal text (removes bold). 恢复正常字体 #o[mobid]# - Shows the name of the mob. 显示 怪物名称 #p[npcid]# - Shows the name of the NPC. 显示npc名称 #q[skillid]# - Shows the name of the skill. 显示技能名称 #r = Red text. 红色字体 #s[skillid]# - Shows the image of the skill. 显示技能图片 #t[itemid]# - Shows the name of the item. 显示物品名称 #v[itemid]# - Shows a picture of the item. 显示物品图片 和前面的i可能相同 #x - Returns "0%" (need more information on this). #z[itemid]# - Shows the name of the item. 显示物品名称,和前面t同 #B[%]# - Shows a 'progress' bar. 显示进度条 #F[imagelocation]# - Shows an image inside the .wz files. 同前面f \r\n - Moves down a line. 换行 \r = Return Carriage \n = New Line \t = Tab (4 spaces) 制表符 4个空格 \b = Backwards 回退 这里又把前面说一次 dispose 结束对话允许再次对话 Ends the conversation with an NPC, allows you to talk to NPCs again. How to use: cm.dispose(); sendNext 有下一个的窗口 Shows a conversation window with a 'Next' button. How to use: cm.sendNext("[text]"); sendPrev 有上一个的窗口 Shows a conversation window with a 'Prev' (previous) button. How to use: cm.sendPrev("[text]"); sendNextPrev Shows a conversation window with a 'Next' and 'Prev' button (see above). How to use: cm.sendNextPrev("[text]"); sendOk Shows a conversation window with an 'Ok' button. How to use: cm.sendOk("[text]"); sendYesNo Shows a conversation window with a 'Yes' and 'No' button, 'No' ends the conversation unless otherwise stated. How to use: cm.sendYesNo("[text]"); sendAcceptDecline 有确认取消的窗口 Shows a conversation window with an 'Accept' and 'Decline' button. 'Decline' ends the conversation unless otherwise stated. How to use: cm.sendAcceptDecline("[text]"); sendSimple 没有东西的窗口,但是实际是有下一个的 有代码 if (!text.contains("#L")) { sendNext(text); return; } 文本如果没有包括"#L"就是那个有选项的就有Next Shows a conversation window with no buttons. How to use: cm.sendSimple("[text]"); sendStyle 带风格的窗口,一般不常用有需要的风格变量 Shows a style-select window. How to use: cm.sendStyle("[Text]", [variable]); // You'll need to declare the variable in a Var statement. warp 传送 ,第二个参数 是0的话用默认的传送点 Warps the player to a map. How to use: cm.warp([mapid], [portal]); // Set [portal] as 0 if you want default. openShop Opens a shop window. How to use: cm.openShop([shopid]); haveItem Checks if the player has an item (in their inventories or equipped). How to use: cm.haveItem([itemid]); gainItem Gives the player an item/takes an item from a player. How to use: cm.gainItem([itemid],[ammount]); // Change [ammount] to -[ammount] to take an item. changeJob Changes the job of the player. How to use: cm.changeJob([jobid]); getJob Finds out what job the player has. How to use: cm.getJob(); startQuest Starts a quest. How to use: cm.startQuest([questid]); completeQuest Finishes a quest. How to use: cm.completeQuest([questid]); forfeitQuest Forfeits a quest. How to use: cm.forfeitQuest([questid]); getMeso Finds out how many mesos a player has. How to use: cm.getMeso(); gainMeso Gives a player mesos/takes mesos from a player. How to use: cm.gainMeso([ammount]); // use -[ammount] to take mesos. gainExp Gives a player exp/takes exp from a player. How to use: cm.gainExp([ammount]); // use -[ammount] to take exp. getLevel Finds out the level of the player. How to use: cm.getLevel(); teachSkill Teaches a player a skill. How to use: cm.teachSkill([skillid],[skilllevel],[maxskilllevel]); get[Stat] Finds out the [Stat] of the player. [Stat] being: HP, MP, STR, DEX, INT, LUK. How to use: cm.get[Stat](); modifyNX Gives/Takes the player nx How to use: cm.gainNX([amount]); Make it negative to make it take away. send函数返回接收 ----------- sendNext(); & sendOk(); ----------- Type = 0 If end chat - mode = -1 结束对话后下次收到-1 If next/ok - mode = 1 按ok或下一个 ----------- sendNextPrev(); ----------- Type = 0 If end chat - mode = -1 结束对话 If next - mode = 1 下一个 if back - mode = 0 返回 ----------- sendYesNo(); ----------- Type = 1 If end chat - mode = -1 If yes - mode = 1 If no - mode = 0 ----------- sendAcceptDecline(); ----------- Type = 12 If end chat - mode = -1 If accept - mode = 1 If decline - mode = 0 ----------- sendGetText(); ----------- Nothing o____o its something special <3 ----------- sendGetNumber(); ----------- Type = 3 If end chat - mode = 0 if ok - mode = 1 ----------- sendSimple(); ----------- Type = 4 If end chat - mode = 0 if select - mode = 1 选择 这里再介绍 几个js的语法 数组 var x=[1,2,3]; 访问就是 x[下标] 下表从0开始 x[0]就是1 比如 item = [4000313, 4001129, 4001126]; function start() { cm.sendSimple("Which would you like? \r\n #L0# Golden Maple Leaf #l \r\n #L1# Maple Coin #l \r\n #L2# Maple Leaf #l"); } function action(mode, type, selection) { if (mode == 1) { cm.gainItem(item[selection], 1); } cm.dispose(); } 可以避免 用switch Math 是js的内部函数,见我前面那个贴的连接 var rand = Math.floor(Math.random()*100); 字典 var x={"x":1,"y":2}; 访问和数组很象 x["x"]就是1 还有cm的一些函数返回本身是类的对象,直接继续点下去访问 如 cm.getPlayer().getJob() 下面看些截图 普通字体,下一步,选项 yesno 字体 换行 显示地图名字 |
|