Post subject: What is the 'Lua Script'?
Player (59)
Joined: 3/15/2011
Posts: 28
Exactlly. What is the 'Lua Script' and how can I use it?
Joined: 7/2/2007
Posts: 3960
Lua is a programming language. Several emulators have integrated it, so that it can be used to control the emulator's behavior, e.g. by reading memory, setting controller inputs, stepping the emulation, and saving and loading states. If you want to learn to use Lua, then you'll need to learn at least the basics of computer programming.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Using ready scripts is just loading them into emulator & running the game they suite for. Writing these scripts if far more difficult and requires knowledge of the Lua's speciffications on usage with emulators (it is used in many other occupations though).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (59)
Joined: 3/15/2011
Posts: 28
Derakon wrote:
Lua is a programming language. Several emulators have integrated it, so that it can be used to control the emulator's behavior, e.g. by reading memory, setting controller inputs, stepping the emulation, and saving and loading states. If you want to learn to use Lua, then you'll need to learn at least the basics of computer programming.
Hmm... You mean, 'Lua' is the computer language...? Where can I learn the Lua script? I think it can be useful for TASing... And, can I make *.lua to *.dsm?
Skilled player (1652)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy
coldsun0630 wrote:
Hmm... You mean, 'Lua' is the computer language...? Where can I learn the Lua script? I think it can be useful for TASing... And, can I make *.lua to *.dsm?
This is where to learn lua- http://www.lua.org/docs.html Lua is a scripting language. Therefore, .lua is a text file full of script commands. .dsm is a desmume playback file, to play tases in desmume. The two couldn't be more incompatible. Many authors on this site use lua to aid them in their creation of TASes. However, lua itself does not create the TAS.
Sage advice from a friend of Jim: So put your tinfoil hat back in the closet, open your eyes to the truth, and realize that the government is in fact causing austismal cancer with it's 9/11 fluoride vaccinations of your water supply.
Editor, Expert player (2331)
Joined: 5/15/2007
Posts: 3940
Location: Germany
http://tasvideos.org/LuaScripting.html For the most part I'm using lua just to show memory address values on the screen. Example:
while true do

gui.text(10,10, "Boss health: " ..memory.readbyte(0xA123))
-- will display the value of address 0xA123 at the coordinates (10/10) on the emulator screen

emu.frameadvance
-- can also be vba.frameadvance or snes9x.frameadvance, depending on the emulator
end
You can also use dependencies:
while true do
a = memory.readbyte(0xA123)
if a < 0 then z = 1000 else z = 10 end
gui.text(10,z, "Boss health: " ..a)
-- Will display the message only when 0xA123 contains a value greater than 0. 

emu.frameadvance
end
There are many more examples... Well, as far as I know, Desmume uses a different way of saying "while true do". Someone else will have to explain...
Emulator Coder, Skilled player (1311)
Joined: 12/21/2004
Posts: 2687
MUGG wrote:
Well, as far as I know, Desmume uses a different way of saying "while true do". Someone else will have to explain...
That was only in the oldest version that supported Lua scripting, because emu.frameadvance hadn't been implemented yet, but it exists now. Although for all I know somebody broke emu.frameadvance in a later version (can somebody explain why the LuaScripting page says it's 'bugged'?).
Editor, Skilled player (1203)
Joined: 9/27/2008
Posts: 1085
nitsuja wrote:
[...] Although for all I know somebody broke emu.frameadvance in a later version (can somebody explain why the LuaScripting page says it's 'bugged'?).
Last I tried emu.frameadvance() in DeSmuME 0.9.6, it did not emulate frames when I tap the actual frame advance key. Even when all that's coded was while true do emu.frameadvance() end, the act of running that nearly empty script prevented emulating each frame one at a time. Works perfectly fine if the emulator isn't paused, which kind of conflicts with the point of TASing. And when I hit the frame advance key, the frame counter does increment... But there's no emulation taking place to go with the increment, at least on this computer. Skipping the usual loop involving emu.frameadvance and simply using the registers instead works just fine, though. I'm guessing this is why it's labeled 'bugged', basing it off my own experience. Can't say I know of any changes since then, due to the fact this computer can't run later versions.
Post subject: Ill just say what emulator uses it or i use
Banned User
Joined: 3/26/2011
Posts: 19
I use fceux to get things straight. It has the option of lua like snow, or jetpack.
Thank you for reading this post. S.S.M