How to Script in Lua, Tutorials and links.
 

How to Script in Lua, Tutorials and links.

Started by merlin_xl54, 15 July, 2008, 14:01:17

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

merlin_xl54

Hi,

Yes I would like to learn how to write Lua scripts and hope everyone can post helpful links and/or examples on how to get started. I have no scripting experience at all. Maybe for Dummies etc. I plan to go back to school and is there a language I should learn first? Or just dive into Lua? Books, Tutorials, links etc. Anything to make it easier for me and other users looking for help.

I find it confusing. Different versions, 5.1x, API 1 & 2 I have spent hours going over this site and reading and trying/testing different scripts. Some of the help tutorials (How to make a Bot) seem to be out dated and don't work for me.

Go easy on me.....

I have looked here and there is quite a bit to take in.

http://www.lua.org/

Thanks,

M
Living is easy with eyes closed.

CrazyGuy

The LUA website is a good place to start  :)
Other documents you'll need are included with PtokaX as the scripting interface.

I've once written a small Guide for beginners on how to work with PtokaX and LUA.
I will attach that to this post.
Unfortunately, it is based on the old api , and I haven't rewritten it yet.
However, it is a point to start with as it covers some of the basics, and includes some sample scripts.
I'd suggest you'd setup a PtokaX 0.3.5.2 hub, and extract the contents of this attachment to its texts folder. (Not scripts !)
Then reload text commands.
After that, type in main
Quote+beginning_px_lua_guide
It should show you a menu with chapters and textcommands.

Quote

      Beginning LUA/PtokaX Scripting Guide

   Chapter 01:   LUA Fundamentals         +lua_fundamentals
   Chapter 02:   PtokaX Scripting Interface      +px_script_interf
   Chapter 03:   Naming your variables      +naming_vars
   Chapter 04:   Strings and Concatenation      +str_concat
   Chapter 05:   Registering a bot          +regbot
         and Hello User script
   Chapter 06:   PtokaX, LUA and the DC++ Protocol   +px_lua_prot
         & Simple Trigger Bot script
   Chapter 07:   Being a better string detective      +str_detective
   Chapter 08:    Are you talking to me ??      +talking_to_me
   Chapter 09: Working with Timers         +timers
   Chapter 10:   A final word         +beginning_final


After you've read through those documents and worked with the example scripts, you probably have enough knowledge of knowing what are exactly the lua calls, and what are the API calls. And, even convert the scripts to the new API yourself  :)
Use LUA's manual and PtokaX Scripting Interface as reference.

Lemmy know if it was of any help, and if something is still unclear after this


?StIfFLEr??

crazy guy can u add up the guide for making new lua script it would be great ......
m truely intrested in making script...

bastya_elvtars

The wiki should be updated (said a few times, but nobody volunteered, I do not have enough time).
Everything could have been anything else and it would have just as much meaning.

Madman

I'm trying to update the wiki from time to time.
I'm working on an overview of API2 here http://wiki.ptokax.ch/doku.php/scriptinghelp/ptokaxapi2
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

?StIfFLEr??

thanks a lot ... this would be a great help for understanding the scripts...

bastya_elvtars

Thanks for the contributions, guys. I'll 'return' in a few weeks and gonna contribute.
Everything could have been anything else and it would have just as much meaning.

?StIfFLEr??


CrazyGuy

#8
I see that many people have shown interrest in checking out my Lua-Guide for PtokaX, cool :D
Finally I've taken the time to convert it for API 2. A few things had to be rewritten, but in general I didn't change much more then just the API related calls throughout the documents.

Check the post above for installation and execution instructions, that's all the same, except this time use a PtokaX 0.4.0.0 or above hubsoft.

Lua-Guide_API2 is attached to this post.

Lemmy know if something's unclear or simply deadwrong :P

TZB

Wow Thanks a Lot i know the post is old But I was seriously searching for such a guide to help me out.Thanks CrazyGuy

Ravage

#10
Hello CrazyGuy

I discovered your Guide some weeks ago, and after reading it I think it enlightened me more about LUA Scripting
than anything else that I went through before.

For me as a beginner, that helped me a lot to understand things like how to capture "stuff" from Arrivals and
every now and then it helped me to answer those little questions like
"what is it for ?/ why it has to be like that ? / and how can you make it work for you ?"
Also i can now read and understand some syntax from other scripts, what is awesome.

The most thing i liked about your tutorial is the fact, that you are not considering anything beneath one to
explain almost every single script line, bit for bit.
I think most of the experienced guys here allready have a good background with some other Programming languages, what i think makes it easier for them to begin and work with LUA. So I guess generally authors of "How To`s" expect more or less some basics, and so called noobs like me are getting frustrated and frightened off a topic instead of dig in and continue deal with it. But not so in your Guide... it gave me some sort of a "Starting line".

Surely it`s always a learning process and the outcoming results are depending on how you actually deal with
information or how you read manuals.

Now,
your Guide has awaken my interest for scripting and made me feel hungry for more.

In the last beginning final writing you mentioned something about an upcoming next unit that you will talk
about using tables and reading/writing files for example. so... are you gonna make that announcement
come true? If yes, is there any chance that you might bring in some lessons about how to work with Profile Permissions and bit more about how to iterate in tables over values i.e.: for a,b in pairs(t) do etc.

I`m sure that not only just me is eagerly awaiting your next chapter.


Regards,

Ravage
Classic Rock to Modern Metal
metal-unity.no-ip.org:980
Join Us!

CrazyGuy

Thank you guys for the kind words, I'm glad it has helped you in learning LUA scripting  ;D
To be honest I haven't thought about writing the sequel for a while. I remember now that I mentioned it in the guide, but I got busy with other things and nobody ever asked.

But sure, why not ?
I can't promise it will be ready next week but gimmy a couple of weeks and I can have a similar guide covering some of the little more advanced structures such as tables.

To ALL that read this: If you have a specific item/question you want me to discuss in the next Guide, now would be the time to mention it :)

TZB

Am i Late on this one?
If not please crazyguy add a manual for learning how to call scripts from 1 lua file.Like in AOI scripting i have been breaking my head over understand those things please if you can it would be a great help for me.

CrazyGuy

Quote from: TZB on 25 August, 2009, 14:52:47
Am i Late on this one?
If not please crazyguy add a manual for learning how to call scripts from 1 lua file.Like in AOI scripting i have been breaking my head over understand those things please if you can it would be a great help for me.

You're not late on this one :)
But I don't really understand what you mean. Can you try and explain it differently ?

TZB

Sorry crazyguy for not explaining what i needed.
Actually i have read many AOI scripts like flexo which used plug in. The main Script is outside the folder and the plugins are inside one of the folder which had different functions. likewise there had been scripts which use setting.ini like file to keep the bot details, right click details etc. i wanted to understand those things. If its possible please crazyguy can u help it with a manual.

CrazyGuy

Okay, yea I can add something about that as well :)

TZB


SMF spam blocked by CleanTalk