Gulron's Noob Questions Thread!

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
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.
Post Reply
Message
Author
User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Gulron's Noob Questions Thread!

#1 Post by Gulron » Mon Dec 29, 2008 8:15 pm

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
Image

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Gulron's Noob Questions Thread!

#2 Post by Administrator » Mon Dec 29, 2008 9:48 pm

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.

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#3 Post by Gulron » Mon Dec 29, 2008 10:01 pm

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.
Okay, thank you very much.

Code: Select all

printf("text")
Edit: On a side note, I see you have;

Code: Select all

printf()
and not;

Code: Select all

print() 
Why is that?
Image

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Gulron's Noob Questions Thread!

#4 Post by Administrator » Mon Dec 29, 2008 11:59 pm

printf() is for C-style formatted printing. print() inserts tabs and newline characters that might not be wanted.

Try this:

Code: Select all

print("This is a print", "statement.", 12345, "\n");
printf("This is a print %s. %d\n", "statement", 12345);
printf() also allows a bit of casting:

Code: Select all

local number = 12345;
printf("%d in hex is 0x%X\n", number, number);

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#5 Post by Gulron » Tue Dec 30, 2008 11:14 am

"%d" will take the first variable after the statement, so what is repeating the variable doing?
Image

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Gulron's Noob Questions Thread!

#6 Post by Administrator » Tue Dec 30, 2008 1:21 pm

%d prints a number in numerical form. %X prints a number in capitol hex form (and %x for lowercase).

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#7 Post by Gulron » Tue Dec 30, 2008 2:40 pm

Administrator wrote:%d prints a number in numerical form. %X prints a number in capitol hex form (and %x for lowercase).
So why the "Ox" at the beginning?
Image

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Gulron's Noob Questions Thread!

#8 Post by Administrator » Tue Dec 30, 2008 4:07 pm

That's a 0, not an O. And it just denotes that it's hexadecimal.

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#9 Post by Gulron » Tue Dec 30, 2008 6:03 pm

Okay I see. printf() gives more leeway for printing scripts while print() just prints out plain text.
Image

zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

Re: Gulron's Noob Questions Thread!

#10 Post by zer0 » Thu Jan 01, 2009 8:34 pm

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

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#11 Post by Gulron » Thu Jan 01, 2009 9:03 pm

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
Whoa! Not ready for that yet.
Image

zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

Re: Gulron's Noob Questions Thread!

#12 Post by zer0 » Thu Jan 01, 2009 10:33 pm

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.

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#13 Post by Gulron » Thu Jan 01, 2009 11:13 pm

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
Image

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#14 Post by Gulron » Sat Jan 03, 2009 12:02 pm

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.

Code: Select all

   a = {}
    for i=1,10 do
      a[i] = io.read()
    end
My question is, where does the 'i' come from?
Image

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Gulron's Noob Questions Thread!

#15 Post by Administrator » Sat Jan 03, 2009 12:24 pm

'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".

User avatar
Gulron
Posts: 12
Joined: Mon Dec 29, 2008 8:10 pm
Location: United States

Re: Gulron's Noob Questions Thread!

#16 Post by Gulron » Sat Jan 03, 2009 4:54 pm

Thanks
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest