PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Heatcliff on 12 February, 2004, 17:18:46

Title: HOW TO: word replacement
Post by: Heatcliff on 12 February, 2004, 17:18:46
Is there a way to make your bot replace words?
I'm fairly new at programming lua, and I couldn't find any reference to this subject.
Title:
Post by: plop on 24 March, 2004, 23:18:29
QuoteOriginally posted by Heatcliff
Is there a way to make your bot replace words?
I'm fairly new at programming lua, and I couldn't find any reference to this subject.

there are some example in this (http://board.univ-angers.fr/thread.php?threadid=763&boardid=4&styleid=1) how-to.
@ the end of part 2 to be precise.
if you want a how-to just about gsub (replacing words) just tell me, i'll make 1 later if needed.

plop
Title:
Post by: pHaTTy on 24 March, 2004, 23:41:16
also check in finsihed scripts for Naughty ASs bot and theres a good example ;-)
Title:
Post by: Corayzon on 24 March, 2004, 23:59:50
This good be of some assistance:-

function translateString(sString, sUserName, e, x, t)
-- System Strings
sString, _ = gsub(sString, "#h", frmHub:GetHubName())

-- Input Strings
sString, _ = gsub(sString, "#u", sUserName)
sString, _ = gsub(sString, "#e", e)
sString, _ = gsub(sString, "#x", x)
if t ~= nil then sString, _ = gsub(sString, "#t", t) end
return sString
end