Author Topic: How to Script in Lua, Tutorials and links.  (Read 10321 times)

0 Members and 1 Guest are viewing this topic.

Offline merlin_xl54

  • Fulll Member
  • ****
  • Posts: 63
  • Karma: +2/-0
  • Not a player, just Playing!
How to Script in Lua, Tutorials and links.
« on: 15 July, 2008, 14:01:17 »
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.

PtokaX forum

How to Script in Lua, Tutorials and links.
« on: 15 July, 2008, 14:01:17 »

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: How to Script in Lua, Tutorials and links.
« Reply #1 on: 16 July, 2008, 14:53:00 »
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


Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: How to Script in Lua, Tutorials and links.
« Reply #2 on: 28 October, 2008, 15:15:24 »
crazy guy can u add up the guide for making new lua script it would be great ......
m truely intrested in making script...

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: How to Script in Lua, Tutorials and links.
« Reply #3 on: 28 October, 2008, 21:20:05 »
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.

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: How to Script in Lua, Tutorials and links.
« Reply #4 on: 28 October, 2008, 23:54:22 »
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

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: How to Script in Lua, Tutorials and links.
« Reply #5 on: 29 October, 2008, 09:39:20 »
thanks a lot ... this would be a great help for understanding the scripts...

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: How to Script in Lua, Tutorials and links.
« Reply #6 on: 29 October, 2008, 17:59:40 »
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.

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: How to Script in Lua, Tutorials and links.
« Reply #7 on: 29 October, 2008, 18:07:35 »
will be waiting for that bustya...:p

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: How to Script in Lua, Tutorials and links.
« Reply #8 on: 27 January, 2009, 23:32:03 »
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
« Last Edit: 28 January, 2009, 12:44:28 by CrazyGuy »

Offline TZB

  • Double Ace
  • *
  • Posts: 119
  • Karma: +13/-1
  • ||-T-z-B-||
    • FastFix Support
Re: How to Script in Lua, Tutorials and links.
« Reply #9 on: 27 June, 2009, 12:00:13 »
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

Offline Ravage

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
  • Forever Metal
Re: How to Script in Lua, Tutorials and links.
« Reply #10 on: 20 August, 2009, 15:50:30 »
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
« Last Edit: 20 August, 2009, 16:03:06 by Ravage »
Classic Rock to Modern Metal
metal-unity.no-ip.org:980
Join Us!

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: How to Script in Lua, Tutorials and links.
« Reply #11 on: 21 August, 2009, 21:15:17 »
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 :)

Offline TZB

  • Double Ace
  • *
  • Posts: 119
  • Karma: +13/-1
  • ||-T-z-B-||
    • FastFix Support
Re: How to Script in Lua, Tutorials and links.
« Reply #12 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.

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: How to Script in Lua, Tutorials and links.
« Reply #13 on: 25 August, 2009, 18:31:50 »
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 ?

Offline TZB

  • Double Ace
  • *
  • Posts: 119
  • Karma: +13/-1
  • ||-T-z-B-||
    • FastFix Support
Re: How to Script in Lua, Tutorials and links.
« Reply #14 on: 25 August, 2009, 19:18:12 »
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.

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: How to Script in Lua, Tutorials and links.
« Reply #15 on: 27 August, 2009, 12:26:40 »
Okay, yea I can add something about that as well :)

Offline TZB

  • Double Ace
  • *
  • Posts: 119
  • Karma: +13/-1
  • ||-T-z-B-||
    • FastFix Support
Re: How to Script in Lua, Tutorials and links.
« Reply #16 on: 27 August, 2009, 13:16:12 »
 :-* :-* Thanks a lot crazyguy. ;D ;D

PtokaX forum

Re: How to Script in Lua, Tutorials and links.
« Reply #16 on: 27 August, 2009, 13:16:12 »