new to Lua Scripting!, I need help!

  • orendr7500
    9th Jun 2015 Member 0 Permalink

    hi there! , i got some things to say first

    1.

    i thought Powder Toy was made with C++/C! 

    2. Lua?, well i tried learning, TRIED, couldent START because i havent found an COMPILER that WORKS

    3. someone knows a good guide? i just want to learn how to do something like PT

  • jacob1
    9th Jun 2015 Developer 0 Permalink
    @orendr7500 (View Post)
    I think you are confused about lua scripting.

    TPT is coded in C / C++, yes. People who make full mods have to get compilers and compile the game, and can change anything about the game. There are guides for that in the wiki (the guides for compiling are amazing, almost impossible to fail any of them)

    But you probably want lua scripting. To access this, press '~' to get into the lua console. You can type any commands here, like dofile("myscript.lua"). You don't need a compiler or anything like that.

    I don't know where any good lua tutorials are, but here is the wiki page with all the tpt commands: https://powdertoy.co.uk/Wiki/W/Powder_Toy_Lua_API.html . You can use the lua api to make anything from new elements to TPT multiplayer, it has a ton of stuff.
  • Factorial
    9th Jun 2015 Banned 0 Permalink
    This post is hidden because the user is banned
  • boxmein
    9th Jun 2015 Former Staff 0 Permalink
    @orendr7500 (View Post)
    Yes, the core (eg the executable files) are all C/++. All of the packaged game mechanics are, too. However, there is support for scripting in Lua, which doesn't need you to recompile the game every time - and also means your modifications can be loaded on any supporting version of TPT, be it jacob1's mod or TPTNET. You'd just have to write your code once. Of course, there's both scope and speed limitations with Lua...

    As well as that, there's a Lua compiler already packaged inside TPT! Just open the dev console (there's a button with a letter C on the right hand side) and type away. You can even include files, which is how all mod distribution is being done - by default TPT runs the file called "autorun.lua" found right next to its executable if you want mods to run right at the start of the game.