LMTS: ILua help anyone?

by Unknown

Back to Project L.

Unknown2008-03-13 16:50:48
The version I'm using should be the one directly before version 2.0, here is what I have got working with LMTS..

Aliases, these work just fine! (havent really experimented though, but got them working)
Custom prompts, these also work just fine! (I modified Zarquan's custom prompt to meet my own needs)

What I want to get working, but can't, are triggers themselves. I directly copied from Whyte's examples the code for triggers, and it wont work! Using echos I found how far the script is getting. It loads the script, but it wont actually go INTO the trigger handler. I fixed that though! I don't know why this fixed it, but it went into the trigger handler after I put on ending paranthesis at the very bottom, here it's setting mb.server_lines to trigger_handler. After I did that however, I got even MORE problems, which trying to fix didn't get me too far.

I'm pretty sure Whyte didn't put up bad code, and I'm confident I'm not making and mistakes on it, so what's the big deal?
Unknown2008-03-13 21:38:28
I've got examples in my code for triggers. In fact, the custom prompt code triggers on the prompt to do the substitution!

Post your code and we'll help you fix it?
Unknown2008-03-14 00:08:32
Well, it's magically working now, and nothing is different. I'm not sure I want to know.

echo("Test module loaded.")

function trigger_handler()
echo("IN THE HANDLER!")
for i = 1, 1 do
echo("IN THE LOOP!")
end
end
mb.server_lines = trigger_handler()

It feels so sketchy, sometimes things work and sometimes they don't, like when I try to add a module to use in config.ilua.txt, I have to put the new modules above the old ones for it to load them. Oh well. As long as I can get a consistently working script with ILua, I'm happy. I still had to have the trailing paranthesis however, which I don't see in the custom prompts triggers.lua file. Uhg..

Anyways, I'll start working on some basic triggers and see how it goes! I hope it works from here on out..

I also noticed the large amount of typos in my last post, that's what I get for posting at the college, no time to proof read.
Unknown2008-03-14 00:31:12
I completely forgot, if you look at the for loop, you'll see the max times is set to 1. This is because it tells me things like mb.nr_of_lines, mb.line, set_line, mb.lines, et cetera, keep giving me errors.

attempt to index field 'lines' (a nil value)

Errors similar to that. Stuck still, bleh..
Unknown2008-03-14 07:37:41
I think I finally have it! Took me a lot of attempts, and it helped copying Zarquan's custom prompt, but I eventually managed to get it to be right where it is now. I tested it with multiple triggers and it seems just fine, so hopefully I'm good to go.

function trigger_handler()
if (mb.line == "Triggering string here") then
echo("Daiseko!")
end
end
mb.server_line = trigger_handler

I noticed I couldn't use a lot of what was on Whytes the way he used it, don't know why, don't care why.. I got it going for now!
Unknown2008-03-14 11:48:50
QUOTE(Linelmarsith @ Mar 14 2008, 03:37 AM) 493617
I noticed I couldn't use a lot of what was on Whytes the way he used it, don't know why, don't care why.. I got it going for now!


Glad you finally got it working. The reason I pointed you to my examples here on this forum is because Whyte's examples are for his newest version, which has differences from the version you're using. If you want to use his examples, you should upgrade to my newer LMTS instead.