佳丽云

英雄无敌3-WoG中文站

 找回密码
 英雄注册|Register
查看: 3952|回复: 5

请问ERA如何使用LUA脚本?

 关闭 [复制链接]
  • TA的每日心情
    开心
    2021-8-22 03:11
  • 签到天数: 22 天

    连续签到: 1 天

    [LV.4]狂狼人

    12

    回帖

    7382

    金币

    0

    精华

    2级 Adventuring Hero

    Rank: 2

    积分
    276
    发表于 2011-7-16 03:01:34 | 显示全部楼层 |阅读模式
    据说ERA1.8已经支持LUA脚本,突然有点兴趣想研究一下,有谁可以指点一下吗?
  • TA的每日心情
    开心
    2020-9-19 16:27
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]火元素使者

    9896

    回帖

    64万

    金币

    19

    精华

    管理员

    风侠

    Rank: 12Rank: 12Rank: 12

    积分
    52111

    论坛元老魅力之星封魔玩家

    发表于 2011-7-16 08:34:53 | 显示全部楼层
    Hello!
    I would want to introduce a new thing for Heroes 3 WOG, ERA Platworm by Berserker.
    Its a .DLL file, still in development, which replaces standard ERM scripts with .LUA scripts.
    I have already said why LUA is better than ERM in other topic, so I'll just quote myself:
    [quote]
    I cannot create my own temat for that so I will write here.
    I'm developing a DLL for ERA platworm with LUA Scripting system instead of regular ERM. The cons of this solution are great:
    > more language flexibility, allowing to create much better things with LUA (tables, iteration, datatypes etc)
    > system reads all .LUA files from .\Data\Lua\ directory and scripts have their own variables, so one script won't mess another like in ERM (even with official 3.58f+script update, there are many variables used by several scripts at once and messing game, causing glitches like ballista named "The first aid tent heals ETC hitpoints" or creatures turning into first aid tents after battle, and even a glitch with 4095 wandering monsters (entering battle = CRASH). with LUA there is NO WAY for scripts to mess up themeselves as every script is handled by his own interface.
    > also other "indexed" things like !!FU numbers are overlapping from script to script
    > better looking code
    > more interesting functions like including other files, math functions (like power, abs, min, max), even saving/loading things on xml, ini files, controlling mouse pointer, running winapi functions and much more
    > better random generator as it now supports FOUR random generators:
    * doGenerateRandomNumber(min, max) - generates random number using !!VR:T erm function
    * lua math.random(min, max) - generates random number using LUA library function
    * RandomNumber(min, max, seed) - generates random number using Pascal random number generator
    * BoxMuller(min, max) - generates random number using box muller alghoritm
    > MUCH more easier to develop a script for H3, a typical newbie-scripter dont have to read 32523523 pages of ERM manual and choosing clean variables from 358f_Claimed.txt, instead he runs a notepad and start writing
    > I'm planning to develop a script editor for that as well
    For now system works stable, and allows to use around 90% of "triggers" and around 40% of "receivers" from ERM (its using ERM interface). Also I icluded few nice things from this forum (like lua function that allows shooting with non-shooters, by Salamandre). It works like a some kind of wrapper:
    instead of ERM -> Heroes3
    we got LUA -> ERM -> Heroes3

    The project is not finished, its still in development. If someone wants to check a BETA, UNTESTED and UNFINISHED LUAErm mod, here is the link:
    http://www.speedyshare.com/files/24922358/_LUA_ERM.rar
    Install instructions:
    1. THIS REQUIRES A PLATWORM ERA 1.6 OR 1.8 BY BERSERKER. ENGLISH COMMUNITY VERSION IS ENOUGH TO MAKE IT WORK. IT CAN BE DOWNLOADED FROM WOGARCHIVE.RU AND PERHAPS FROM OTHER SITES.
    2. RENAME YOUR HEROES3\DATA\S\ FOLDER TO SOMETHING OTHER (AS BACKUP), BECAUSE ALL SCRIPTS HAVE TO BE DELETED
    < ~-- VERY IMPORTANT --~ >
    3. MAKE SURE THAT IN YOUR DATA\S\ DIRECTORY, THERE ARE NO ERM SCRIPTS
    < ~-- VERY IMPORTANT --~ >
    4. UNPACK ARCHIVE INTO ROOT HEROES3 FOLDER
    5. IF CORRECT, FILES WILL BE THERE:
    > Heroes3\Celtica.dll
    > Heroes3\lua.dll
    > Heroes3\lualib.dll
    > Heroes3\luareceivers.txt
    > Heroes3\luatriggers.txt
    > Heroes3\Data\lua\test.lua
    > Heroes3\Data\lua\xxx.lua
    > Heroes3\Data\lua\global\global.lua
    > Heroes3\s\Script00.erm
    6. LAUCH GAME AND START A SCENARIO. IF CORRENT, A DEBUG.TXT FILE WILL BE CREATED IN ROOT H3 DIRECTORY.
    But beware! It wasnt supposed to be released now, its just untested and still in development. I have uploaded it, because I wanted to show that I'm doing real thing, not only words.
    Most of receivers are still untested and not guarantee to work. The most part that's done are !!OB, !!UN, !!MO, !!SN and similar. The list of lua functions are in text files luareceivers.txt and luatriggers.txt.
    ---
    How this does work?
    After Heroes3 map is started, Celtica.dll is called from ERM. For now all scripts in .\Data\Lua\ directory are parsed and translated into byte code by LUA library. Now on certain events (90% of triggers are working now), lua functions from all files are called. LUA Functions are handled by Celtica.dll which passes variables out and in and calls standard ERM !!FU's from Script00.erm. The script00.erm should not be modified as its now only used as a engine.
    Also few notes:
    > saving and loading game is still not implemented. scripts should work after loading game, but its not handled and variables will get reset after loading. its just still not done yet.
    > lua comments are strict and must start with two -- chars
    > list of lua functions sometimes refer to "pos" as parameters/function results. pos is a lua table with three fiels - X,Y,Z.
    in order to delete an object from pos 25/22/0, you must create a pos table and push it into function:
    local ourBadPos = {x=25, y=22, z=0}
    doDeleteObject(TRUE, ourBadPos)
    if position is passed as parameter from a function, you can refer to it by typing this in script:
    ourBadPos.x = 55  --this will set X of ourBadPos to 55
    local mySuperVar = ourBadPos.y  --this will set mySuperVar equal to Y of ourBadPos

    other parameters are mostly string and integer-based. for example function
    function onHeroMove(hero, pos)
    hero is a number from 0..155 indicating hero ID.
    > global.lua is a special file which is ALWAYS parsed as primary file for all script. it contains few definitions to make scripting more useful, if you need some constants, there is a good list in global.lua
    for example, you don't have to remember which color is which number - you can only write PLAYER_BLUE and this will equal 1 (as 1 = blue for Heroes3 and ERM)
    > if script is not doing anything, make sure that it have loaded properly. scripts are not parsed in runtime, they are translated to bytecode during loading - this means that if there is a syntax error in code, it wont load at all, just drop an error in debug.txt file.
    Thats all from my side. Thanks.[/quote]
  • TA的每日心情
    开心
    2020-9-19 16:27
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]火元素使者

    9896

    回帖

    64万

    金币

    19

    精华

    管理员

    风侠

    Rank: 12Rank: 12Rank: 12

    积分
    52111

    论坛元老魅力之星封魔玩家

    发表于 2011-7-16 08:52:25 | 显示全部楼层
    原帖在此
    http://heroescommunity.com/viewthread.php3?TID=33943
  • TA的每日心情
    奋斗
    2020-8-30 18:40
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]投石矮人

    1047

    回帖

    1万

    金币

    1

    精华

    5级 Honorable Hero

    Rank: 5Rank: 5

    积分
    4479

    社区QQ达人退役版主

    QQ
    发表于 2011-7-16 10:00:05 | 显示全部楼层
    什么啊,ERA不是和ERM是亲戚吗
    Zeratul教你怎样玩转WOG。
    五步入门法:
    1.下载WOG:
    《WOG简体中文完美包》下载
    2.查看关键设置:新手必看,推荐设置
    3.学会游戏技巧:大量有用的资料
    4.学习ERM,虐待电脑:ERM新手教程
    5.精品名图全都有:大量精品地图
    —————————————————————————
    精品ERM小配件:
    1.
    老实猪版第一追随者
    2.木瓜的第二追随者
    3.宝物典当行
    4.大富翁脚本
    5.指挥官野外复活
  • TA的每日心情
    慵懒
    2019-8-17 09:46
  • 签到天数: 1158 天

    连续签到: 2 天

    [LV.10]圣龙

    2万

    回帖

    91万

    金币

    7

    精华

    论坛嘉宾

    守望论坛的稻草人

    Rank: 9Rank: 9Rank: 9

    积分
    87636

    社区QQ达人论坛守望者金牌裁判杰出贡献魅力之星TE联赛冠军

    发表于 2011-7-16 11:02:23 | 显示全部楼层
    您好!
    我希望英雄无敌3 WOG,自责狂暴Platworm引进的新事物。
    仍处于开发阶段,其中一个DLL文件,取代了标准的ERM脚本。Lua脚本。
    我已经说过为什么Lua是比其他主题的ERM更好,所以我只是引述自己:
    将英语译成中文

    我不能创造我自己的temat,所以我会写在这里。
    我开发一个时代Lua脚本系统,而不是定期的ERM platworm的DLL。这种解决方案的利弊是巨大的:
    >更多语言的灵活性,允许LUA(表,迭代,数据类型等)来创建更好的东西
    >系统读取所有的\数据\的Lua \目录和脚本Lua文件有自己的变量,所以一个脚本将不乱另一个像在ERM(甚至与官方3.58f +脚本更新,有几个使用的许多变量脚本一次搞乱游戏,造成像弩毛刺名为“急救帐篷愈合ETC生命值”或生物转化后的战斗急救帐篷,甚至与4095年徘徊的怪物(进入战斗= CRASH)的毛刺与lua有没有办法惹了themeselves作为每一个脚本的脚本是由他自己的界面处理。
    >还有其他的“索引”之类的东西!傅数字是重叠的,从脚本到脚本
    >好看的代码
    >更有趣的功能,如包括其他文件,数学函数(如电源,ABS,最小值,最大值),即使保存/加载XML的东西,ini文件,控制鼠标指针,运行WINAPI功能和更
    >更好的随机数发生器,它现在支持4个随机发生器:
    * doGenerateRandomNumber(最小,最大) - 产生随机数使用VR:T ERM功能!
    * LUA math.random(最小,最大) - 使用Lua库函数产生随机数
    * RandomNumber(最小值,最大值,种子) - 使用Pascal的随机数发生器产生的随机数
    * BoxMuller(最小,最大) - 生成随机数,使用框穆勒alghoritm
    >更容易开发H3,一个典型的新手脚本编写者没有读32523523页企业风险管理手册和干净的变量选择从358f_Claimed.txt的脚本,而不是他运行一个记事本,并开始编写
    >我的规划开发,脚本编辑器,以及
    现在的系统工作稳定,并允许使用90%左右的“触发器”,约40%的ERM(其使用的企业风险管理接口)的“接收器”。另外,我icluded几个不错的东西,从这个论坛(如Lua函数,允许非射手由Salamandre拍摄)。它工作起来就像一个某种形式的包装:
    而不是企业风险管理 - > Heroes3
    我们得到的LUA - >企业风险管理 - > Heroes3
    朗读
    显示对应的拉丁字符的拼音字典


    该项目还没有完成,它仍然在发展。如果有人想检查测试,未经测试和未完成的LUAErm的按付款当日价格计算的,这里是链接:
    http://www.speedyshare.com/files/24922358/_LUA_ERM.rar
    安装说明:
    1。这需要一个PLATWORM时代狂暴1.6或1.8。英语社区版就足以使其工作。 IT可以WOGARCHIVE.RU也许从其他网站下载。
    2。重命名你的HEROES3 \ DATA \ \文件夹在东西(如备份),因为所有的脚本都被删除
    < - 很重要的 - &#12316;>
    3。确保在\ \目录下,你的数据有无ERM脚本
    < - 很重要的 - &#12316;>
    4。进入根HEROES3文件夹解压缩存档
    5。如果正确,文件将在那里:
    > Heroes3 \ Celtica.dll
    > Heroes3 \ lua.dll
    > Heroes3 \ lualib.dll
    > Heroes3 \ luareceivers.txt
    > Heroes3 \ luatriggers.txt
    > Heroes3 \数据\ LUA \ test.lua
    > Heroes3 \数据\ LUA \ xxx.lua
    > Heroes3 \数据\ LUA \全球\ global.lua
    > Heroes3 \ \ Script00.erm
    6。劳克游戏和启动情况。 IF电流量,一个DEBUG.TXT文件将被创建在根H3的目录。
    但是请注意!这是不应该是现在公布的,只是未经检验的,并且仍然在发展。我已经上传了,因为我想证明,我做真实的东西,不仅字。
    接收器大多仍是未经测试并不能保证工作。这样做了大部分!转播,!联合国!密苏里!SN和类似。 Lua函数列表的文本文件luareceivers.txt和luatriggers.txt。
    ---
    如何这不工作?
    Celtica.dll Heroes3地图开始后,被称为从企业风险管理。现在\数据\的Lua \目录中的所有脚本被解析并翻译成字节码的Lua库。现在对某些事件(90%的触发工作),所有文件的Lua函数被调用。 Lua函数处理Celtica.dll,它传递出并的变量和调用Script00.erm标准的ERM!富的。作为其现在只有一个发动机使用的script00.erm不应该被修改。
    也很少注意事项:
    >保存和载入游戏仍然没有实现。脚本应该载入游戏后,但它不是处理和变量就会加载后复位。刚刚还在尚未完成。
    > LUA的意见是严格,必须以两个 - 字符
    > Lua函数的列表,有时指“POS”作为参数/功能结果。 POS是一个Lua表三个感觉 - X,&#8203;&#8203;Y,Z
    以删除POS 25/22/0的对象,你必须创建一个名次表,并推入功能:
    当地ourBadPos = {X = 25,Y = 22,Z = 0}
    doDeleteObject(真,ourBadPos)
    如果位置是作为一个函数的参数传递,你可以参考它在脚本中键入:
    ourBadPos.x = 55 - 这将设置ourBadPos X到55
    当地mySuperVar = ourBadPos.y - 这将设置mySuperVar等于ourBadPos &#376;

    其他参数大多是基于字符串和整数。例如功能
    功能onHeroMove(英雄,POS)
    主人公是一个从0 .. 155表示英雄的ID。
    > global.lua是一个特殊的文件,这始终是作为主文件的所有脚本解析。它包含了一些定义,以使脚本更加有用,如果你需要一些常量,在global.lua有一个很好的列表
    例如,你没有记住哪个颜色是哪个号码 - 你可以只写PLAYER_BLUE的,这将等于1(1 =蓝Heroes3和ERM)
    >如果脚本没有做任何事情,请确保它已正确装入。脚本在运行时解析,他们转换为字节码装载过程中 - 这意味着,如果是在代码中的语法错误,它不会加载所有,只是下降debug.txt文件中的错误。
    这就是从我的身边。感谢。
  • TA的每日心情
    开心
    2021-8-22 03:11
  • 签到天数: 22 天

    连续签到: 1 天

    [LV.4]狂狼人

    12

    回帖

    7382

    金币

    0

    精华

    2级 Adventuring Hero

    Rank: 2

    积分
    276
     楼主| 发表于 2011-7-16 20:52:22 | 显示全部楼层
    HC这个帖子里的
    http://www.speedyshare.com/files/24922358/_LUA_ERM.rar
    已经无法下载,不知道谁有留档呢,麻烦传一下
    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 英雄注册|Register

    本版积分规则

    捐赠
    关注我们,英3Mod一网打尽!

    WoG中文站 ( 辽B2-20210485-10 )|辽公网安备 21128202000228 号

    GMT+8, 2024-6-5 03:52 , Processed in 0.348609 second(s), 15 queries , Gzip On, File On.

    Powered by Discuz! X3.4

    Copyright © 2004-2022, Beijing Second Sight Technology Co., LTD.

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