PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: slick on 21 September, 2005, 13:44:02

Title: help error running word replacer
Post by: slick on 21 September, 2005, 13:44:02
just started running this script an i get the following error :

Syntax cannot read wordreplace/tLadys.lua: No such file or directory

Syntax ...UA 5)\scripts\zzword_replacer_1.2.lua_5.0_public.lua:253: attempt to index local `fFile' (a nil value)
Fatal error in script zzword_replacer_1.2.lua_5.0_public.lua ! Script stopped!
Script started.


A fix would be greatly appreciated t/y
Title:
Post by: Typhoon on 21 September, 2005, 18:47:33
open the lua file in a editor ..
then find this part

function Main()
   local num = string.gsub(os.date(), "%D", "")
   math.randomseed(tonumber(num))

   dofile("wordreplace/tLadys.lua")
   dofile("wordreplace/tBadWords.lua")
   dofile("wordreplace/tBadFunctions.lua")
   local fFile = io.open("wordreplace/tHistory.lua")
   if fFile then
dofile("wordreplace/tHistory.lua")
fFile:close()
   end
   if iRegBot then
frmHub:RegBot(sBot, 1, "friendly wordreplacer<[URL]www.plop.nl[/URL]>", "lua.plop.nl")
   end
end

and change it to this part
function Main()
   local num = string.gsub(os.date(), "%D", "")
   math.randomseed(tonumber(num))

   --dofile("wordreplace/tLadys.lua")
   dofile("wordreplace/tBadWords.lua")
   dofile("wordreplace/tBadFunctions.lua")
   local fFile = io.open("wordreplace/tHistory.lua")
   if fFile then
dofile("wordreplace/tHistory.lua")
fFile:close()
   end
   if iRegBot then
frmHub:RegBot(sBot, 1, "friendly wordreplacer<[URL]www.plop.nl[/URL]>", "lua.plop.nl")
   end
end

that should fix the problem...

Typhoon?
Title:
Post by: slick on 21 September, 2005, 19:17:06
ok t/y i will try that and get back to you
Title:
Post by: slick on 21 September, 2005, 19:23:18
for the life of me i couldn't see what was changed but it works like a charm t/y



slick
Title:
Post by: bastya_elvtars on 21 September, 2005, 19:39:09
Hmm, I was thinking of this:

local num = string.gsub(os.date(), "%D", "")
math.randomseed(tonumber(num))

Wouldn't it be easier to:

math.randomseed(os.time())
Title:
Post by: Typhoon on 22 September, 2005, 17:30:40
QuoteOriginally posted by slick
for the life of me i couldn't see what was changed but it works like a charm t/y



slick

your welcome slick :)

and to Bastya

tell plop that :)

Typhoon?
Title:
Post by: plop on 22 September, 2005, 18:22:15
QuoteOriginally posted by bastya_elvtars
Hmm, I was thinking of this:

local num = string.gsub(os.date(), "%D", "")
math.randomseed(tonumber(num))

Wouldn't it be easier to:

math.randomseed(os.time())

would be easier indeed.
but it's not a real waste as it's only triggered 1x (at script startup).

plop