Gulron's Noob Questions Thread!
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Gulron's Noob Questions Thread!
So after reading about MicroMacro and actually using it for myself I am really intrigued. After reading a little about Lua and testing out a few simple Lua scripts in MicroMacro it has encouraged me to begin learning the programming language Lua so I can create macros for MicroMacro.
I have no real experience in scripting before so I have created this thread so that I could possibly get some help with the questions to come. I have looked at the RoM bot you have posted for download and opened up some of the files in LuaEdit 2.5 to experiment with.
My first question is: What is the difference between a .tag and a .lua file? I know .lua is the script file itself, so what is the .tag?
-Gulron
I have no real experience in scripting before so I have created this thread so that I could possibly get some help with the questions to come. I have looked at the RoM bot you have posted for download and opened up some of the files in LuaEdit 2.5 to experiment with.
My first question is: What is the difference between a .tag and a .lua file? I know .lua is the script file itself, so what is the .tag?
-Gulron

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Gulron's Noob Questions Thread!
There was no .tag file included in the RoM bot or any other that I am aware of, so it must be something associated with the software you are using.
In all reality, the file extensions don't mater. You do not need to name your files with the .lua extension to run them through MicroMacro.
In all reality, the file extensions don't mater. You do not need to name your files with the .lua extension to run them through MicroMacro.
Re: Gulron's Noob Questions Thread!
Okay, thank you very much.Administrator wrote:There was no .tag file included in the RoM bot or any other that I am aware of, so it must be something associated with the software you are using.
In all reality, the file extensions don't mater. You do not need to name your files with the .lua extension to run them through MicroMacro.
Code: Select all
printf("text")
Code: Select all
printf()
Code: Select all
print()

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Gulron's Noob Questions Thread!
printf() is for C-style formatted printing. print() inserts tabs and newline characters that might not be wanted.
Try this:
printf() also allows a bit of casting:
Try this:
Code: Select all
print("This is a print", "statement.", 12345, "\n");
printf("This is a print %s. %d\n", "statement", 12345);
Code: Select all
local number = 12345;
printf("%d in hex is 0x%X\n", number, number);
Re: Gulron's Noob Questions Thread!
"%d" will take the first variable after the statement, so what is repeating the variable doing?

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Gulron's Noob Questions Thread!
%d prints a number in numerical form. %X prints a number in capitol hex form (and %x for lowercase).
Re: Gulron's Noob Questions Thread!
So why the "Ox" at the beginning?Administrator wrote:%d prints a number in numerical form. %X prints a number in capitol hex form (and %x for lowercase).

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Gulron's Noob Questions Thread!
That's a 0, not an O. And it just denotes that it's hexadecimal.
Re: Gulron's Noob Questions Thread!
Okay I see. printf() gives more leeway for printing scripts while print() just prints out plain text.

Re: Gulron's Noob Questions Thread!
printf is used because Elverion finds it easier to remember and shorter. However it's just a function reference to string.format() which can be located here:
http://lua-users.org/wiki/StringLibraryTutorial
http://lua-users.org/wiki/StringLibraryTutorial
Re: Gulron's Noob Questions Thread!
Whoa! Not ready for that yet.zer0 wrote:printf is used because Elverion finds it easier to remember and shorter. However it's just a function reference to string.format() which can be located here:
http://lua-users.org/wiki/StringLibraryTutorial

Re: Gulron's Noob Questions Thread!
Ok, then my best advice is to not start looking at the MicroMacro scripts yet.
Instead download lua and do a few tutorials.
http://lua-users.org/wiki/LuaTutorial
The tutorials may be a bit boring but you can probably pick it up in a few weeks if your new to programming.
When your confident that you can do most without any issue, then start modifying MM Scripts to suit your needs.
Lua has many uses outside of MicroMacro, and is one of the most popular scripting languages so it's definitely worth learning if you want to get into any programming. In fact an Open Source MMORPG I've worked on in the past now use Lua for most of there NPC's I believe.
If you get the core fundamentals right coding MM Scripts will be a breeze. My first mistake was trying to make scripts without much knowledge about Lua, when I started looking at the reference pages and learning the building blocks, that is when I started coding some seriously cool scripts.
It's always great to hear someone enthusiastic about learning about them and not just using scripts, Good luck and all the best.
Instead download lua and do a few tutorials.
http://lua-users.org/wiki/LuaTutorial
The tutorials may be a bit boring but you can probably pick it up in a few weeks if your new to programming.
When your confident that you can do most without any issue, then start modifying MM Scripts to suit your needs.
Lua has many uses outside of MicroMacro, and is one of the most popular scripting languages so it's definitely worth learning if you want to get into any programming. In fact an Open Source MMORPG I've worked on in the past now use Lua for most of there NPC's I believe.
If you get the core fundamentals right coding MM Scripts will be a breeze. My first mistake was trying to make scripts without much knowledge about Lua, when I started looking at the reference pages and learning the building blocks, that is when I started coding some seriously cool scripts.

It's always great to hear someone enthusiastic about learning about them and not just using scripts, Good luck and all the best.
Re: Gulron's Noob Questions Thread!
Thank you Zer0! Much appreciation for your tips.
I'm on Chapter 2 of http://www.lua.org/pil/index.html so far and have been enjoying learning about Lua.
Thanks again,
Gulron
I'm on Chapter 2 of http://www.lua.org/pil/index.html so far and have been enjoying learning about Lua.
Thanks again,
Gulron

Re: Gulron's Noob Questions Thread!
In Chapter 2.5 of Programming in Lua it teaches you about tables and I am a little confused. Here is the snippet of coding they use.
My question is, where does the 'i' come from?
Code: Select all
a = {}
for i=1,10 do
a[i] = io.read()
end

- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Gulron's Noob Questions Thread!
'i' is just another variable. 'i' is often used in for-loops as the incremented value (hence, 'i'). Variables in Lua do not need to be explicitly declared, so it is created as soon as you see "for i".
Who is online
Users browsing this forum: No registered users and 1 guest