2DWorlds Forums
onChatted - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Off Topic (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=5)
+--- Forum: Programming (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=30)
+--- Thread: onChatted (/showthread.php?tid=6705)

Pages: 1 2


onChatted - Nyht - 07-09-2011

I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


[lua]npc = create("NPC")
label = create("Label")

print("Loaded Cloning Script")

--[[ function onChatted(msg) ]]--
if msg == "/clone" then
print("Cloning " .. speaker.Name)
npc.Parent = game.World
npc.Name = speaker.Name
label.Parent = npc
label.Text = speaker.Name .. "'s Clone"
npc.Skin = speaker.Character.Skin
print(speaker.Name .. " was successfully cloned.")
else
print(speaker.Name .. "was insuccessfully cloned.")
end
end
link(Player.Chatted, onChatted)[/lua]


RE: onChatted - Nice - 07-09-2011

(07-09-2011, 06:23 AM)Nyht Wrote: I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


[lua]npc = create("NPC")
label = create("Label")

print("Loaded Cloning Script")

--[[ fuction onChatted(msg) ]]--
if msg == "/clone" then
print("Cloning " .. speaker.Name)
npc.Parent = game.World
npc.Name = speaker.Name
label.Parent = npc
label.Text = speaker.Name .. "'s Clone"
npc.Skin = speaker.Character.Skin
print(speaker.Name .. " was successfully cloned.")
else
print(speaker.Name .. "was insuccessfully cloned.")
end
end
linkSadPlayer.Chatted, onChatted)
print(speaker.Name .. " was successfully cloned.")[/lua]


:crazy: Did you do all that?


RE: onChatted - Nyht - 07-09-2011

(07-09-2011, 08:14 AM)Nice Wrote:
(07-09-2011, 06:23 AM)Nyht Wrote: I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


[lua]npc = create("NPC")
label = create("Label")

print("Loaded Cloning Script")

--[[ fuction onChatted(msg) ]]--
if msg == "/clone" then
print("Cloning " .. speaker.Name)
npc.Parent = game.World
npc.Name = speaker.Name
label.Parent = npc
label.Text = speaker.Name .. "'s Clone"
npc.Skin = speaker.Character.Skin
print(speaker.Name .. " was successfully cloned.")
else
print(speaker.Name .. "was insuccessfully cloned.")
end
end
linkSadPlayer.Chatted, onChatted)[/lua]


:crazy: Did you do all that?

It is quite simple for an intermediate coder.

I fixed the double of line 14.


RE: onChatted - Duck - 07-09-2011

Well for some reason the start of your function is a note


RE: onChatted - Jacob__mybb_import1 - 07-09-2011

Maybe because you said "fuction" instead of "function"? Tongue


RE: onChatted - AK-47 - 07-09-2011

"Maybe because you said "fuction" instead of "function"? Tongue"

I laugh at myself when I get typos like this one.


RE: onChatted - Jacob__mybb_import1 - 07-09-2011

I still forget semicolons when writing PHP... and it was the first language I learned. [Image: facepalm.gif]


RE: onChatted - Qwertygiy - 07-09-2011

And you don't need a : between link and (.


Yeah, I'm constantly getting typos in my scripts. Stuff like part.Trasparency or game.Payers:getChildren.
(07-09-2011, 02:34 PM)Jacob_ Wrote: I still forget semicolons when writing PHP... and it was the first language I learned. [Image: facepalm.gif]

I've only started PHP two days ago. Long live w3schools and their massive database!


RE: onChatted - AK-47 - 07-09-2011

"game.Payers:getChildren"

You can't pay using children, that's illegal...


RE: onChatted - Qwertygiy - 07-09-2011

I honestly cannot believe how I managed to script for months on ROBLOX without knowing about Output. Seriously. Because I make so many little mistakes -- especially now that I know two versions of Lua and I keep trying to subconsciously intertwine them -- that I can't make a 50 line script without one typo.