PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Progressive_Rocker_1960 on 04 December, 2003, 10:14:27

Title: Scripting
Post by: Progressive_Rocker_1960 on 04 December, 2003, 10:14:27
Professor Phatty or any of the other LUA Gurus,

I have a question regarding LUA.

I am writing a Trigger Bot, just a simple remark and response. In order to conserve memory & processor is it better to incode the triggers and responses or would it be better to call a text file.

Will probably have end up with 10 triggers & Responses.

Any help with this would be greatly appreciated.

Title:
Post by: pHaTTy on 04 December, 2003, 10:50:53
well it is better to be in same fle, as it using processor to read from text file, but there not mich difference for a triggerbot, and it doesnt take much ;)

-phatz
Title:
Post by: klownietklowniet on 04 December, 2003, 12:42:34
It doesn't take anything if you read the triggers from file at script startup in the main function and put them in an assosiative table.  Then it's a simple lookup when the trigger command is typed in main or in pm. No reading from file at that point....
Title:
Post by: Progressive_Rocker_1960 on 05 December, 2003, 06:30:15
Thank you both very much that gives me a couple ideas. That is about what I had figured, especially with a small script like a trigger bot.  I will yell if I run into anything else.
Title:
Post by: IceCoder on 09 December, 2003, 11:30:50
is it faster to have a text in the code instead to read a text fil?
Title:
Post by: plop on 09 December, 2003, 13:02:25
QuoteOriginally posted by IceCoder
is it faster to have a text in the code instead to read a text fil?
depends how you do it.
if you load the txt file on start of the bot it doesn't make a difference.
but if you don't it'll be slower, as you have 2 open the file over and over again.

plop
Title:
Post by: IceCoder on 09 December, 2003, 13:56:53
ok....
Title:
Post by: SaintSinner on 09 December, 2003, 14:23:36
QuoteOriginally posted by IceCoder
ok....


ok....?