|
| 12 Jan 2013 05:31 PM |
I have this so far:
game.Players.PlayerAdded:connect(function(player) function talked (msg) msg:lower() if msg ==
end
player.Chatted:connect(talked)
What I want to do is make a table and have the if msg == cycle through the table to see if what the player said is one of the words in the table and recognize what that word is. |
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
| |
|
|
| 12 Jan 2013 05:34 PM |
| I am not a noob, I just have never dealt with tables before. |
|
|
| Report Abuse |
|
|
Saltless
|
  |
| Joined: 24 Dec 2012 |
| Total Posts: 107 |
|
|
| 12 Jan 2013 05:36 PM |
u r nob (pls dont reveal my identitee if u no et)
allowedWords = { "Word1", "Word2", "SoOn"} -- Put these lower case if using :lower()
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(chat) local msg = chat:lower() for i = 1, #allowedWords do if msg == allowedWords[i] do -- col stoof end end) end)
-- A fry without salt is like a world without hate. |
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
|
| 12 Jan 2013 05:37 PM |
player.Chatted:connect(function(string) for i, v in pairs(words) do if string:lower() == v:lower() then
end end end) |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 05:39 PM |
No.
Words = { "1", "2", "3", "etc"}
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(chat) local msg = chat:lower() for i = 1, #Words do if msg == Words[i]:lower() do -- col stoof end end end) end)
|
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
|
| 12 Jan 2013 05:40 PM |
| Nice code, it's inefficient. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 05:41 PM |
| Inefficiency ~= Less letters |
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
|
| 12 Jan 2013 05:42 PM |
local msg = chat:lower()
Useless. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 05:44 PM |
Not necessarily useless. But if you must, you could remove that and add it to the check.
if chat:lower() == Words[i]:lower() then
Not useless, just a preference. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 05:46 PM |
Ahh, mistakes I can see.
Words = { "1", "2", "3", "etc"}
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(chat) for i,v in ipairs(Words) do if chat:lower() == v:lower() then -- Code end end end) end) |
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
|
| 12 Jan 2013 05:47 PM |
| New variable was what I meant. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 05:51 PM |
| New variables aren't inefficient, it's just placing a piece of code somewhere ahead of time. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 06:59 PM |
What does this mean?
if chat:lower() == v:lower() then
|
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 07:05 PM |
| turns it both into lowercased for easier comparison |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 07:11 PM |
Oh nevermind all it does is lower each variable and see if they are alike, I want to find out which one it is though, not if it is one of them.
Like if a guy chats 1 then the function will run, but I don't know if he said 1, 2 ,3 or etc. |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Jan 2013 08:54 PM |
Words = { "1", "2", "3", "etc"}
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(chat) if chat:lower() == Words[1]:lower() then -- Code elseif chat:lower() == Words[2]:lower() then --Code end end) end) |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 09:50 PM |
@cody'
omg how you learn so much qq |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 09:54 PM |
| I may be able to do this, but I get lost when I try hopperbins. qq |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 10:01 PM |
| lol, I never liked tables and all this crap, I enjoy tools and guis alot more. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 10:05 PM |
| Does Words[1] mean the first part of the table or the thing named 1? |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 10:06 PM |
Really? I prefer tables and this 'crap'. :D Hopperbins don't interest me. Guis are alright.
|
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 10:08 PM |
The first part.
Words = {"Hello", "noob"}
print(Words[1],Words[2])
>Hello noob |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 12 Jan 2013 10:12 PM |
@cody,
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(function() if mouse.Target then print(mouse.Target) end end) end)
- What have the mini-mods come to nowadays? - |
|
|
| Report Abuse |
|
|