Scripts - closed source

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
zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

Scripts - closed source

#1 Post by zer0 » Fri Sep 26, 2008 1:52 am

It would be good if the scripts can be pre-compiled so they are closed source.

It might encourage users to share their scripts, since it can be shared in a pre-compiled format.

Part of this reasoning is that developers may want to create versions which can be used free, but also charge those who try and profit off of it, such as gold traders.

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

Re: Scripts - closed source

#2 Post by Administrator » Fri Sep 26, 2008 10:07 am

You can. You just first need to download the Lua compiler. Normally, this is included with the library, but since you're probably not interested in coding in C++, you probably won't have that. You can get the binaries here:
http://luabinaries.luaforge.net/download.html

Now, you should probably rename the luac5.x file to just 'luac.exe' (Windows) or 'luac.bin' (Linux).
You should then put luac into one of your system paths (typically, C:/Windows/system32/ in Windows). Now, open your command prompt (Start->Run->cmd) and cd to the directory of the Lua file you want to compile. Use the command "luac -o outfile.lua filename.lua" and it will compile filename.lua and dump outfile.lua file, which is the compiled version of the script.

Although you are fully able to compile your scripts, it might not always be the best solution. Be aware that compiling small scripts often ends up in the file size swelling quite a bit. Also, I believe the Lua compiled format has some endianness issues still, which means that your compiled scripts may not work on other systems. According to the Linux man pages, however, endianness is no longer an issue, but word size is. This means, if your scripts are compiled on a 32bit machine, a 64bit machine cannot use them.


I've attached a working copy of luac for Windows x86 just in case the Lua Binaries site has more problems.
Attachments
luac.zip
(103.77 KiB) Downloaded 141 times

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Scripts - closed source

#3 Post by 3cmSailorfuku » Sat Sep 27, 2008 4:07 am

elverion wrote:You can. You just first need to download the Lua compiler. Normally, this is included with the library, but since you're probably not interested in coding in C++, you probably won't have that. You can get the binaries here:
http://luabinaries.luaforge.net/download.html

Now, you should probably rename the luac5.x file to just 'luac.exe' (Windows) or 'luac.bin' (Linux).
You should then put luac into one of your system paths (typically, C:/Windows/system32/ in Windows). Now, open your command prompt (Start->Run->cmd) and cd to the directory of the Lua file you want to compile. Use the command "luac -o outfile.lua filename.lua" and it will compile filename.lua and dump outfile.lua file, which is the compiled version of the script.

Although you are fully able to compile your scripts, it might not always be the best solution. Be aware that compiling small scripts often ends up in the file size swelling quite a bit. Also, I believe the Lua compiled format has some endianness issues still, which means that your compiled scripts may not work on other systems. According to the Linux man pages, however, endianness is no longer an issue, but word size is. This means, if your scripts are compiled on a 32bit machine, a 64bit machine cannot use them.


I've attached a working copy of luac for Windows x86 just in case the Lua Binaries site has more problems.
Probably an Obfuscator is the way to go :)

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

Re: Scripts - closed source

#4 Post by Administrator » Sat Sep 27, 2008 12:40 pm

We could run some tests on the Lua bytecode. I've wrote a small test script which should give us some info.

Here's the source:

Code: Select all

printf("This is a script compiled on a 32bit big endian machine with a 80586 processor.\n");


printf("Counting to ten...\n");
for i = 1, 10 do
  print(i);
end


printf("\n\n(7 * 2) + 5 = ");
print( (7 * 2) + 5 );
printf("\n\n");



function testFunction()
  printf("This is a test function. If you see this message, the test passed.\n");
end

testFunction();
printf("If you did not just see the \'test passed\' message, the function test has failed.\n");
I've attached the script (test.lua), compiled Lua binary (testc.lua), and a small (Win32) program that tells you if your computer is big endian or little endian. If you've got a 64bit machine, or if you have a little endian system, try running the compiled script and see what happens.

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

Re: Scripts - closed source

#5 Post by zer0 » Sun Sep 28, 2008 4:17 am

I know lua can be compiled, but what about our MicroMacro scripts? MicroMacro does the linking required, so how would I go about compiling a Micromacro based script? Wouldn't the Micromacro function calls generate compile errors if we just used luac.exe? :?
And once I've done that how would I go about loading it into Micromacro?
Or even better, run it as a stand-alone program.

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Scripts - closed source

#6 Post by 3cmSailorfuku » Sun Sep 28, 2008 7:58 am

zerosignal wrote: And once I've done that how would I go about loading it into Micromacro?
Or even better, run it as a stand-alone program.
micromacro.exe yourscript.

Or you could append it to lib.lua via an include. It does work, however I'm not sure if its safe and stable.
Your script will be loaded then everytime you start micromacro.

But being able to compile it into a standalone beats the reason of opensource.
Part of this reasoning is that developers may want to create versions which can be used free, but also charge those who try and profit off of it, such as gold traders.
Would probably be against the license. I like MicroMacro this way. I can send you a dll that will be called from micromacro which generates an unique HWID you can use to verify if its a valid copy.

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

Re: Scripts - closed source

#7 Post by Administrator » Sun Sep 28, 2008 2:11 pm

I know lua can be compiled, but what about our MicroMacro scripts? MicroMacro does the linking required, so how would I go about compiling a Micromacro based script?
As Lua is a run-time scripting language, it is not linked at compile time. It assumes that stray symbols will be resolved later.

And once I've done that how would I go about loading it into Micromacro?
Or even better, run it as a stand-alone program.
Exactly the same way you load your scripts now. The script is just compiled into a byte-code, which will speed up the load time and make the script non-human-readable.

Lua cannot be compiled directly into a stand-alone program. It still requires an interpreter. It is possible to actually compile a Lua script into micromacro.exe, however. This is all within the license.

3cmSailorfuku wrote:
zerosignal wrote:
Part of this reasoning is that developers may want to create versions which can be used free, but also charge those who try and profit off of it, such as gold traders.
Would probably be against the license. I like MicroMacro this way. I can send you a dll that will be called from micromacro which generates an unique HWID you can use to verify if its a valid copy.
There is no restriction on redistribution, so he could sell it if he likes. I don't necessarily support the selling of MicroMacro and/or script packages, but I don't want to restrict it's use so much that it becomes useless. But yes, that actually is a pretty good idea with the plugin.

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

Re: Scripts - closed source

#8 Post by zer0 » Mon Sep 29, 2008 1:49 am

I tried compiling a test file, and running it in MicroMacro, it didn't work for me.

Image

I renamed the "test.out" file, as the forum did not allow the out extension through.

Regarding what I mean by closed source
I'm not sure that your fully understanding what I mean. I'm not talking about releasing a closed source version of MicroMacro, regardless if it infringes on the license or not that would just be a dog act.

I'm talking about the possibility of compiling my scripts so they are closed source, and selling them. Time is money, and if I want to make scripts well, I have to convert the time into money. Since I would spending time on making scripts, those scripts will have to make some money. Or else I would have to find other work and do this as a hobby (which never produces quality software). Granted open-sourcing can with several people (or someone sponging off of spouse, parents, government), but in the several months that I worked on zs_shaiya (that was under GPL) and a several thousand lines of code later, not one person contributed really anything back, with the exception of both of you which helped me with the Micromacro API, and general Lua queries.

I'm too old and have financial obligations, so if I continue to write scripts, I need a way for it to contribute to my bread and butter.
Attachments
test.out.txt
(1.31 KiB) Downloaded 142 times
test.lua
(907 Bytes) Downloaded 151 times

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Scripts - closed source

#9 Post by 3cmSailorfuku » Mon Sep 29, 2008 2:49 am

zerosignal wrote:I tried compiling a test file, and running it in MicroMacro, it didn't work for me.

Image

I renamed the "test.out" file, as the forum did not allow the out extension through.
My bad, you have to add scripts/test.out. It works here.
zerosignal wrote: I'm too old and have financial obligations, so if I continue to write scripts, I need a way for it to contribute to my bread and butter.
I assume everyone here could need a little money, I'm too young and I need money, for example I'm working on Japanese -> English translations for Aer*agames and I get $50 per Batch which is done in about 30 minutes. I'm using that money to invest into stocks, which is very successful if you have alot of self discipline.

Though I never seen someone trying hard to make money of a macro.
Of course that Shaiya Dongle that bypasses the "Anticheat" protections, which is srsly a dumb macro, you should fix that for them and get paid.
But the only profitable bots I know of are those that are being sold to Goldcompany's, and they're really hardcore.

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

Re: Scripts - closed source

#10 Post by Administrator » Mon Sep 29, 2008 12:10 pm

I compiled your test script and ran it here just fine. Are you maybe on a 64bit machine? Did you use the 64bit Lua compiler?

DarkP
Posts: 5
Joined: Wed Oct 08, 2008 12:37 pm

Re: Scripts - closed source

#11 Post by DarkP » Wed Oct 08, 2008 10:36 pm

What about if I just want to hide the main code but let the user modify the parameters? Sort of idiot-proofing my scripts...

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

Re: Scripts - closed source

#12 Post by zer0 » Wed Oct 08, 2008 11:15 pm

@elverion
No, and yes I am using a 64-bit machine, which is probably the issue. I'll take another look at it.

edit:
I compiled with the Win64 binaries, did you use the "test.out.txt" file. or compile it yourself first?

I tried using the Win32 binaries and it worked for me which is great. :)
DarkP wrote:What about if I just want to hide the main code but let the user modify the parameters? Sort of idiot-proofing my scripts...
I was curious about this so I tested it, using the include function, you can include un-compiled scripts, and it will compile them on-the-fly.
So you can have a main script that's compiled, and a config.lua that's uncompiled, then in the main file just call it like so:

Code: Select all

include("config.lua");

As always, thanks for the support.

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

Re: Scripts - closed source

#13 Post by Administrator » Thu Oct 09, 2008 3:38 pm

edit:
I compiled with the Win64 binaries, did you use the "test.out.txt" file. or compile it yourself first?

I tried using the Win32 binaries and it worked for me which is great. :)
I tried both running the bytecode (compiled script) you had attached and compiling it myself. Worked when I compiled it, but yours did not work for me.

I was curious about this so I tested it, using the include function, you can include un-compiled scripts, and it will compile them on-the-fly.
So you can have a main script that's compiled, and a config.lua that's uncompiled, then in the main file just call it like so:

Code: Select all

include("config.lua");
This is correct. You can include/dofile another Lua script whether or not it is also compiled or not. So, just don't compile the config file.

The real reason I'm commenting on this is because the functionality of include() has recently changed (within the last few days). Previously, include() would include scripts based on a relative folder from the micromacro folder. Now, it will include scripts from your 'working path', relative direction to the working path, or from a full path. If this confuses you (and it probably will) [url=http://solarimpact.servegame.com/wiki/i ... ry#include]read all up on it in it's entry in the wiki[url].

Basically, you would previously need to do this:

Code: Select all

include("/scripts/myproject/functions.lua");
But this only works if 'myproject' is in the micromacro/scripts folder. Now, it "just works" wherever it is, and is easier/simpler to follow and nest.

Code: Select all

include("functions.lua");

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest