generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Minor chat problem

Previous Thread :: Next Thread 
GooeyChopsticks is not online. GooeyChopsticks
Joined: 25 Nov 2015
Total Posts: 632
05 Dec 2015 06:23 PM
local Blocks = {
["%s(noob)%s"] = "new person",
}

for i, v in next, Blocks do
Chat = Chat:gsub(i, v)
end

So, I have decided that ROBLOX's filter allows for some pretty harsh language. I was making this, but realized it will not work if they say NooB or something, because it will not be lowercase. Is there any way around this? I used to know how, but I am having a brain block.
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
05 Dec 2015 06:24 PM
local Blocks = {
["%s(noob)%s"] = "new person",
}

for i, v in next, Blocks do
Chat = Chat:lower():gsub(i, v)
end
Report Abuse
GooeyChopsticks is not online. GooeyChopsticks
Joined: 25 Nov 2015
Total Posts: 632
05 Dec 2015 06:26 PM
Hmm I was thinking that, but that removes their capital letters ;(
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
05 Dec 2015 06:32 PM
local Bad = {
["noob"] = "new person",
}

function Sub(match)
if Bad[match:lower()] then
return Bad[match:lower()]
else
return match
end
end

str = str:gsub("%S+",Sub)
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
05 Dec 2015 06:34 PM
local Blocks = {
["noob"] = "new person",
}

for Key, Block in next, Blocks do
for i = 1, #Chat:lower() do
if i-#Key == Block then
-- Chat[i-#Key] == replace it somehow
end
end
end
Report Abuse
GooeyChopsticks is not online. GooeyChopsticks
Joined: 25 Nov 2015
Total Posts: 632
05 Dec 2015 06:36 PM
@CHIMMILORD

I don't really understand your code; if you could, explain it.

Also, I am not sure if it does, but I need it to make sure it has some kind of %s character before and after it (so it doesn't mistake if I say like, fasst on accident) and also, I need it to preserve their capital letters.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
05 Dec 2015 07:24 PM
local Chat = "yoU NoOb "

local wordsCI = {
["noob"] = "new person",
}

for pattern, replacement in pairs(wordsCI) do
local i,j = 1, 1
local ChatLower = Chat:lower()
repeat
i, j = ChatLower:find(pattern, j+1)
print(i,j)
if not i then break end
if not Chat:sub(i-1,i-1):match("[^%s]") and not Chat:sub(j+1,j+1):match("[^%s]") then
Chat = Chat:sub(1,i-1)..replacement..Chat:sub(j+1)
j = j +(#replacement - (j-i+1))
end
print(i, j)
until not j
print(Chat)
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image