PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: JueLz on 25 August, 2006, 20:38:13

Title: How to compile bot
Post by: JueLz on 25 August, 2006, 20:38:13
I have a bot with some commands i'd like to compile for my hub....
does anyone know how to compile ??!!!
Title: Re: How to compile bot
Post by: Stormbringer on 25 August, 2006, 21:50:08
It sucks to compile script...
DC is open source, the bot should stay open source too...
You can use the text editor Scite to compile scripts, but it sucks...
Title: Re: How to compile bot
Post by: st0ne-db on 25 August, 2006, 22:51:00
Quote from: JueLz on 25 August, 2006, 20:38:13
I have a bot with some commands i'd like to compile for my hub....
does anyone know how to compile ??!!!

download the LUA binaries from:

LUA 5.1.1 (http://luaforge.net/frs/download.php/1420/lua5_1_Win32_bin.tar.gz)
LUA 5.0.2 (http://luaforge.net/frs/download.php/788/lua5_0r2_Win32_bin.tar.gz)


Extract the files and look for:

luac5.exe   <-- LUA 5.1.1
luac50.exe <-- LUA 5.0.2

open a DOS window... and compile the script..

luac5 luascript.lua

after completion look for the file called a.out in the folder you compiled in.
rename it from luac.out to desired scriptname.lua

thats it, hope this help you.

-St0ne db
Title: Re: How to compile bot
Post by: JueLz on 25 August, 2006, 23:01:29
ill try it out
Posted on: 25 August 2006, 23:56:54
Can you write down here the commands on how to compile
Title: Re: How to compile bot
Post by: st0ne-db on 25 August, 2006, 23:08:47
Quote from: JueLz on 25 August, 2006, 23:01:29
Can you write down here the commands on how to compile

Get the binaries from my last post..

open a DOS window..  goto Start --> Run --> cmd.exe

then change directory to where you extracted the files...


C:\Documents and Settings\St0ne db>cd \lua

run the compiler....

C:\lua>luac50 myscript.lua

look for the file called  luac.out


C:\lua>dir

Directory of C:\lua

08/25/2006  04:05 PM    <DIR>          .
08/25/2006  04:05 PM    <DIR>          ..
07/31/2006  05:34 PM    <DIR>          bak
05/05/2005  08:30 AM           106,496 lua50.dll
03/18/2005  11:11 AM           217,088 lua50.exe
08/25/2006  04:05 PM             9,253 luac.out
03/18/2005  11:11 AM           114,688 luac50.exe
08/01/2006  09:37 PM             9,827 myscript.lua
08/05/2006  02:26 AM    <DIR>          tar
              17 File(s)      1,037,035 bytes
               6 Dir(s)   9,322,995,712 bytes free



rename it to whatever you want..

C:\lua>ren luac.out myscript-c.lua


-St0ne db

Title: Re: How to compile bot
Post by: Thor on 25 August, 2006, 23:12:14
Quote from: st0ne-db on 25 August, 2006, 22:51:00
open a DOS window... and compile the script..

luac5 luascript.lua
Start menu -> Run... -> cmd
Go into the folder where you extracted the luac5 file and write then eg.:
luac5 c:\PtokaX\scripts\I_wanna_compie_it.lua
then you see in there an I_wanna_compie_it.out file. You should rename it to the filename, what you want, like this: whis_is_my_firstandlast_compoled_bot.lua ;D
Title: Re: How to compile bot
Post by: Stormbringer on 25 August, 2006, 23:59:06
QuotePosted by: Hungarista
Start menu -> Run... -> cmd
Go into the folder where you extracted the luac5 file and write then eg.:
luac5 c:\PtokaX\scripts\I_wanna_compie_it.lua
then you see in there an I_wanna_compie_it.out file. You should rename it to the filename, what you want, like this: whis_is_my_firstandlast_compoled_bot.lua Grin

just a correction Hungarista:
The output filename is:
This_is_my_firstandlast_compiled_bot_It's_a_promise.lua
Grin
Title: Re: How to compile bot
Post by: st0ne-db on 26 August, 2006, 00:10:42
Quote from: Stormbringer on 25 August, 2006, 23:59:06
just a correction Hungarista:
The output filename is:
This_is_my_firstandlast_compiled_bot_It's_a_promise.lua
Grin

This is the way luac works....

usage: luac [options] [filenames].  Available options are:
  -        process stdin
  -l       list
  -o name  output to file `name' (default is "luac.out")
  -p       parse only
  -s       strip debug information
  -v       show version information
  --       stop handling options


without the -o switch the compiler will use the default output name of:  luac.out

to specify a different filename..

luac -o luascript-c.lua luascript.lua

-St0ne db
Title: Re: How to compile bot
Post by: JueLz on 26 August, 2006, 00:48:44
1 question can't i run it the normal way?
like... just clickin in the icon?
Title: Re: How to compile bot
Post by: st0ne-db on 26 August, 2006, 03:27:44
no, it uses a command line interface... DOS is the only way.
But you can add it to the context menu in windows xp. Here's how:

Open My Computer..
Click Tools --> Folder Options..
Click the File Types tab..
Find the extension LUA in the list, highlight it..
Click the Advanced button..
Click New..

For LUA5.0.2 enter these values:

Action:  Compile -> LUA5.0.2
Application: "C:\LUA\LUAC5.EXE" -o "%L.c50" "%L"

making sure to set the correct path to the lua compiler

For LUA5.1.1 enter these values:

Action: Compile -> LUA5.1.1
Application: "C:\LUA\LUAC5.1.EXE" -o "%L.c51" "%L"

again... the path is very important.. make sure it is correct.

Click Ok... Ok...

your done... now when you right click on a lua file you can compile it... and a new file will appear
in the current folder with the extension of .c50 or c51 for lua5.0.2 and lua5.1.1
just rename the file to .lua and you are done.

-St0ne db




Title: Re: How to compile bot
Post by: JueLz on 26 August, 2006, 10:22:37
Thanks Stone it works
Title: Re: How to compile bot
Post by: st0ne-db on 26 August, 2006, 10:33:07
Quote from: JueLz on 26 August, 2006, 10:22:37
Thanks Stone it works

No problem  :)
Title: Re: How to compile bot
Post by: speedX on 26 August, 2006, 10:35:36
aaaaa.....can anyone tel me wat is the use to compile a script??
Title: Re: How to compile bot
Post by: st0ne-db on 26 August, 2006, 10:45:24
Quote from: speedX on 26 August, 2006, 10:35:36
aaaaa.....can anyone tel me wat is the use to compile a script??

"The main advantages of precompiling chunks are: faster loading, protecting source code from user changes, and off-line syntax error detection."

"Pre-compiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. luac simply allows those bytecodes to be saved in a file for later execution."

check this page http://www.lua.org/manual/4.0/luac.html (http://www.lua.org/manual/4.0/luac.html)

or just google "luac" and hit 'im feeling lucky (http://www.google.com/search?hl=en&lr=&q=luac&btnG=Search)'   :P

-St0ne db
Title: Re: How to compile bot
Post by: bastya_elvtars on 26 August, 2006, 12:04:21
Quote from: speedX on 26 August, 2006, 10:35:36
aaaaa.....can anyone tel me wat is the use to compile a script??

Noone can see your l4m3r coding. :P
And some idiots can create commercial scripts for verli.
Title: Re: How to compile bot
Post by: Herodes on 26 August, 2006, 12:19:47
Quote from: bastya_elvtars on 26 August, 2006, 12:04:21
Noone can see your l4m3r coding. :P
And some idiots can create commercial scripts for verli.
commercial ? how do you mean that ?
Title: Re: How to compile bot
Post by: bastya_elvtars on 26 August, 2006, 12:24:45
Quote from: Herodes on 26 August, 2006, 12:19:47
commercial ? how do you mean that ?

Sell it for money. It's an antiflood script.

You've gotta be the member of the closed section, pay a fee of 10EUR per year.
Then you can get the script. It is compiled, and will work only on your hub. No warranties, and you will be banned from the closed section if you redistribute, these terms and conditions can be changed anytime.
This is a quick version of what is described here (http://ro.4242.hu/cgi-bin/yabb2/YaBB.pl?num=1147107532).
Title: Re: How to compile bot
Post by: PPK on 26 August, 2006, 14:04:30
Quote from: Stormbringer on 25 August, 2006, 21:50:08
DC is open source
No, Direct Connect is not opensource :P
Title: Re: How to compile bot
Post by: Stormbringer on 26 August, 2006, 15:36:30
Thx PPK, one more time... I don't know how I could live without you....
The compilation sucks, it's a fact.
Soooooooo fun when you want change something in the script, and you can't cause the code is block!!!!
Even for design impossible to change even one line, sorry but the compilation is a true shit.
Compiled script are not flexible, and most of hub owners are looking for flexible scripts, that you can customize to looks pretty on your hub.
Title: Re: How to compile bot
Post by: JueLz on 26 August, 2006, 18:09:17
Yes but i want to compile a bot for a major good reason
Title: Re: How to compile bot
Post by: Northwind on 26 August, 2006, 20:44:26
Quote from: JueLz on 26 August, 2006, 18:09:17
Yes but i want to compile a bot for a major good reason
hmhm i not seeing any of your scripts on any lua board. So does this mean u use others code and brand it to your own. I think answer is yes when u didnt already know how to compile scripts. I never liked robocop as it was compiled, now im happy with leviathan what has all i need and its not compiled. I can say that most of users aint want to use compiled as they are less configurable...
Title: Re: How to compile bot
Post by: JueLz on 26 August, 2006, 21:20:05
I also love leviathan
i don't like compiled bot.....
i am compiling scripts because of a server i have ...
Title: Re: How to compile bot
Post by: bastya_elvtars on 27 August, 2006, 12:44:21
Quote from: JueLz on 26 August, 2006, 21:20:05
i am compiling scripts because of a server i have ...

???
Title: Re: How to compile bot
Post by: Mik13 on 25 February, 2007, 15:55:17
It is possible,  to compile only a part of a code that it would be possible to change the menu and some options?
Excuse for my English         :)
Title: Re: How to compile bot
Post by: Psycho_Chihuahua on 25 February, 2007, 16:04:07
You could compile the bot and use a *.ini file for various settings.

But like most others think here - COMPILING IS LAME -  :P

"Exeption: Scripts like D2AF are best to be compiled so no sukkers can get around the security or identification methods"