Interactive Lua (perhaps a stupid question)
Interactive Lua (perhaps a stupid question)
Is there a way to run an interactive Lua interpreter in the Micromacro window, i.e. just like when we start Lua with no arguments but with the full Micromacro functionality available?
Best regard
DX
Best regard
DX
Re: Interactive Lua (perhaps a stupid question)
You mean like the bots commandline.xml script? I have a version that doesn't require Runes of magic to be running if you are interested.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Interactive Lua (perhaps a stupid question)
You can also use the exec command at the script prompt to run single statements. The only thing is that you shouldn't use double quotes ("") or it will confuse the parser.
example:
example:
Code: Select all
Script> exec print('hello world');
Re: Interactive Lua (perhaps a stupid question)
Both hints are good I'd like a copy of your script Rock.
Thx,
Dx
Thx,
Dx
Re: Interactive Lua (perhaps a stupid question)
Building new scripts (not rombot) and probing processes I always wanted an interactive environment to test in.
To get a 'normal' Lua interpreter to work in with full functionality of Micromacro I used the lua.c file from Lua 5.2 distribution and built it as a .dll for loading into Micromacro.
This leaves me with a session like:
DX
To get a 'normal' Lua interpreter to work in with full functionality of Micromacro I used the lua.c file from Lua 5.2 distribution and built it as a .dll for loading into Micromacro.
This leaves me with a session like:
I have attached the files used, please re-compile to build your own and don't rely on my binaries.MicroMacro v1.04.167
SolarStrike Software
http://www.solarstrike.net
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script> lua
Opening lua.lua...
Starting script execution - Press CTRL+C to exit.
Press CTRL+L to cancel execution and load a new script.
-------------------------------------------------------
Press the (F6) key to stop/pause the script.
You can resume with the (F5) key.
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
>
- I use MinGW32 for compilation.
- The lua.lua script I put in micromacro/scripts
- The cmd.dll I put in micromacro/lib/mods/cmd.dll
DX
- Attachments
-
- commandline.zip
- Contains the source and .dll of command line interface, version 0.1
- (10.42 KiB) Downloaded 475 times
- Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Interactive Lua (perhaps a stupid question)
I've added this as built-in with MM2 now and it will be included with future releases. It works much the same way. Just use the 'exec' command without any parameters to enter interactive mode, and 'exit' to quit:
Thanks for your input.
Code: Select all
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script> exec
> print("hello world!");
hello world!
> abc = "test";
> print(abc);
test
> exit
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script>
Re: Interactive Lua (perhaps a stupid question)
Just place it in "micromacro/scripts" then type "cl" in micromacro.dx876234 wrote:Both hints are good I'd like a copy of your script Rock.
Thx,
Dx
That sounds excellent.Administrator wrote:I've added this as built-in with MM2 now and it will be included with future releases. It works much the same way. Just use the 'exec' command without any parameters to enter interactive mode, and 'exit' to quit:
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Interactive Lua (perhaps a stupid question)
Btw, by adding a waypoint as below you will also get a Lua interpreter with full Rom bot functionality and can manually control your client.
-DX
-DX
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<waypoints>
<onLoad>
<![CDATA[
cmd = require "cmd"
cmd.LuaInterpreter()
]]>
</onLoad>
</waypoints>
Who is online
Users browsing this forum: No registered users and 11 guests