Page 1 of 10

LunaLua Offical Thread

Posted: 13 Sep 2014, 12:55
by Kevsoft
I recently had the idea if I should stream some LunaLua live development. Just say if you would be interested or not.



Heya all, I'm here to present Lunadll with Lua (Alpha-Version)!
I used most of the last week to work on this, and I think it's turning out pretty well. The problem with Autocode (the lunadll-language) is the lack of flexibility that it has (such as the way it lacks custom functions, variables.etc).

So first of all: What is lua?
Lua is an actual script language, which supports custom functions, variables and much more. The script type is something like JavaScript + Visual Basic

Download
LunaDLL for lua reference & example page (outdated since v0.2.7)
PLEASE NOTE: I am currently rewriting the documentary HERE: http://wohlsoft.ru/wiki/index.php?title=Category:LunaLua_API
LunaLua Tutorial
You might want to google other lua tutorials too.

How to install:
1. You'll need a "hexed" smbx client (A2XT or Raw)
2. If you have finished setting up everything, then download this (if you haven't already), replace Lunadll.dll with the new dll and copy the Lua dlls.
3. There is an example folder in the zip file containing two examples. To use them, copy the lua file in the custom folder of your level and rename it to "lunadll.lua" (similiar to lunadll.txt)
3.1. Example "wind.lua" - moves the character +1 of the x-coordinates to simulate wind (pretty fun :P)
3.2. Example "harmtest.lua" - every 1000 frames, the player gets a "fake-hit"

Which lua-libs can I access?

Code: Select all

string.*
math.*
table.*
debug.*
os.* --Limited (only time/date works), because of security reasons

Posted: 13 Sep 2014, 15:44
by elitalianoverde
Oh! NICE! I actually know a lot about lua! This will be great!

Posted: 13 Sep 2014, 15:51
by Kevsoft
With luck, I might get this version into talkhouse :D!

Posted: 13 Sep 2014, 15:59
by elitalianoverde
So you somehow managed to get all this stuff into lua then?
http://www.gamearchaeology.com/LunaDLL.html

these two are like examples i think
http://www.gamearchaeology.com/lunaref.txt
http://www.gamearchaeology.com/TUTORIAL.txt

Posted: 13 Sep 2014, 16:09
by Wohlstand
elitalianoverde, also I'm collecting these info to my "Collected" archive http://wohlsoft.ru/docs/Collected/LunaDLL/

Posted: 13 Sep 2014, 16:17
by Kevsoft
There is not everything in it yet, also it is completly diffrent.

Instead of:

Code: Select all

#0
FilterToSmall,0,0,0,0,0,0
#END

you use:

Code: Select all

function onLoopSection0()
   player.powerup = SMALL
end


and if you wanna do it only once:

Code: Select all

doOnce = true
function onLoad()
   doOnce = true
end
function onLoopSection0()
   if(doOnce)then --Does on the first run of this loop!
      player.powerup = SMALL
      doOnce = false
   end
end


You see, it is more script-style...

Posted: 13 Sep 2014, 16:43
by Veudekato

Posted: 13 Sep 2014, 20:11
by Alucard
For DareDevil comet level, a script is much simplier:
"daredevil.lua"

Code: Select all


[int]MOUNT_NONE = 0
[int]NPC_NONE = 0

function onLoad()
 player.powerup = SMALL
 player.mount = MOUNT_NONE
 player.reservePowerup = NPC_NONE
end

Another suggestion: onLoad() should run before first frame is drawn on screen.

Posted: 13 Sep 2014, 20:14
by Kevsoft
I will do something like that, btw, remove the [int], this is not a part of the script, it is just a indicator what is required

Posted: 13 Sep 2014, 21:21
by tb1024
One I day I had a dream where LunaDLL used Lua.
Did I preview the future?
Anyway, gonna try it. LunaDLL really sucked because it was a assembler-like language, but now it is a true programming language.

Posted: 13 Sep 2014, 21:27
by Wohlstand

Code: Select all

.model tiny
.code
org 100h
main  proc
      mov    ah,9
      mov    dx,offset to_tb1024
      int    21h
      retn
to_tb1024 db 'Yea, is not easy$'
main  endp
end   main


:biggrin:

Posted: 13 Sep 2014, 21:46
by Alucard
Kevsoft wrote:I will do something like that, btw, remove the [int], this is not a part of the script, it is just a indicator what is required
I have previously getting used to C & C++. :facepalm:

Posted: 13 Sep 2014, 22:05
by Kevsoft
Lua is like Javascript :P Variables can be redefined and don't need a type-signature!

Posted: 14 Sep 2014, 0:42
by FanofSMBX
Can this do anything more than regular lunadll can?

Posted: 14 Sep 2014, 0:43
by Wohlstand
FanofSMBX wrote:Can this do anything more than regular lunadll can?
Yes, because Lua is addon over regular LunaDLL, and was built together with regular LunaDLL's sources, and you can use AND regular LunaDLL commands, AND lua scripts

Posted: 14 Sep 2014, 20:07
by Luigifan2010
Name is LuaDLL please ;-)

Posted: 14 Sep 2014, 20:10
by Wohlstand
Luigifan2010 wrote:Name is LuaDLL please ;-)
Better: LunaLUA :) which working over LunaAssembly - main LunaDLL's script language

Posted: 14 Sep 2014, 23:02
by tb1024
I prefer LuaDLL. It fits both as a parody of LunaDLL and to show the programming language.
Wohlstand wrote:
Luigifan2010 wrote:Name is LuaDLL please ;-)
Better: LunaLUA :) which working over LunaAssembly - main LunaDLL's script language
LunaDLL's language has no name. I call it LunaDLL's Assembler-Like Language just to have something to call it.


Darkchao made a LunaTXT generator, but it is so crappy I laughed about it.
It still requires LunaDLL knowledge, still require a memory offset knowledge... Thing that Kevsoft will surely simplify.


Kev, is this a LunaDLL modded from source?

Posted: 14 Sep 2014, 23:55
by Kevsoft
tb1024 wrote:Kev, is this a LunaDLL modded from source?
Yes it is modded from source. Probably tomorrow I will release the next version, which I will post on talkhaus too.

Posted: 15 Sep 2014, 4:27
by tb1024
My suggestions:
  • Instead of using hex addresses in memory, we can provide a type which will provide these addresses as variables. Example: Instead of using the 0x+118 address to change the NPC direction, we could use a [npc-name].direction variable. We can still leave the hex addresses for both backwards compatibility and when a value is not available as variable .
  • Provide some built-in functions (like Layer_Hide()).
  • Write a reference.