PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: servaks on 20 October, 2003, 09:07:27

Title: Problems with variables
Post by: servaks on 20 October, 2003, 09:07:27
I have a big problem...

I want to create a language file for my bot..
Now it looks like this:


openter =  "Operator \"..user.sName..\" has entered the hub."


But in hub i get:

Operator "..user.sName.." has entered the hub.


What shud i do ?

Plz help...

/shipis
Title:
Post by: ptaczek on 20 October, 2003, 17:21:00
Where is some problem? The code does exactly what it should.

Maybe you would like to try:

[size=2]openter =  "Operator "..user.sName.." has entered the hub."[/size]
Title:
Post by: servaks on 20 October, 2003, 17:49:25
Now i get error :
Syntax Error: attempt to index global `user' (a nil value)

/shipis
Title:
Post by: OpiumVolage on 20 October, 2003, 19:01:08
Try something like this:

openter =  "Operator [USER] has entered the hub."

and in the message sent:
local tmp = gsub(openter, "%b[], user.sName)
SendToAll("Bot", tmp)
Title:
Post by: servaks on 20 October, 2003, 19:02:29
wow
too dificult for me :D

but i hope i will get this work after some time...

/shipis
Title:
Post by: plop on 21 October, 2003, 02:52:10
i'm using the next way in my a.i bot

this is placed in OpConnected.
SendToAll(Bot, WELCOME1.." "..user.sName.." "..WELCOME2.." "..frmHub:GetHubName().."|")
and this is in the config file, in your case the language file.
-- default welcome text
WELCOME1 = "Welcomes operator"
WELCOME2 = "here at"
2gether this gives,
<-Bure-> Welcomes operator [TGA-OP]plop here at the golden angel testhub
might be less configurable but on the other hand, harder 2 mess up.

plop
Title:
Post by: klownietklowniet on 21 October, 2003, 02:56:09
Servaks: how does the OpConnected function look? what have you called the parameter variable? You should cahnge 'user' to that one...
Title:
Post by: servaks on 21 October, 2003, 13:39:09

function OpConnected(user)
SendToAll(botname, "Operator "..user.sName.." has entered the hub.")
end


/shipis
Title:
Post by: klownietklowniet on 21 October, 2003, 20:53:03
That should work like a charm... I dont' think that should give any errors..