Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 3:31 pm

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1847 posts ]  Go to page 1, 2, 3, 4, 5 ... 74  Next
Author Message
PostPosted: Tue Sep 23, 2008 2:47 am 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
This is based on William's tutorial. I found it a little unoptimized. So I did a little modification to it, and I also added in a replacing system. . First, in mod Globals, go add the following :

Code:
Public SwearArray() as string
Public ReplaceSwearArray() as string
.

Now, go to sub Main. At the top, declare the following variable :

Code:
Public SwearString as string


In the same sub, right after :

Code:
Call CheckTiles


add :

Code:
' Use the swear string to store the original swear words
SwearString = "ass,fuck,shit,bitch,damn,cunt,whore,piss"
SwearArray = Split(SwearString, ",")

' Use the swear string to store the replace swear words
SwearString = "donkey,luck,matress,lucky charms,cow,moo,jokeofweek,yellow"
ReplaceSwearArray = Split(SwearString, ",")


Now, to add in your own words, just add the swear word to the first string, and then add the replacement to the second string :)

Now, just add this function (a modified version of CheckMessage) :

Code:
Public Function CheckMessage(byval Msg As String) As String
Dim i As Long

    CheckMessage = Msg

    For i = 0 To UBound(SwearArray)
           CheckMessage = Replace$(CheckMessage , SwearArray(i), ReplaceSwearArray(i), , , vbTextCompare)
    Next i
   
End Function


And there you go, you now have an optimized chat filter system which replaces swears with what you want them to. And, to quote william,:

Quote:
Now search for all the different messages: adminmsg, saymsg, broadcastmsg, globalmsg, playermsg, mapmsg.

And do this on all of them:
Code:
Call GlobalMsg(ChatText)

Replace it with:
Code:
Call GlobalMsg(CheckMessage(ChatText))

And of course you shouldn't replace the saymsg call with a globalmsg call...

Good Luck And have Fun

_________________
Image


Last edited by JokeofWeek on Tue Sep 23, 2008 2:58 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Sep 23, 2008 2:56 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Unfortunately, it won't work...it will only replace the last swear word in the string. Like this:

Msg = "shit whore fuck bitch" for example...

CheckMessage = "**** whore fuck bitch" but Msg is still the same so it will look for the second swear...so then

CheckMessage = "shit ***** fuck bitch" and then Msg will still equal the same thing...so you do:

Code:
Public Function CheckMessage(byval Msg As String) As String
Dim i As Long
   
    For i = 0 To UBound(SwearArray)
        CheckMessage = Replace$(Msg, SwearArray(i), ReplaceSwearArray(i), , , vbTextCompare)
        If CheckMessage <> Msg Then Msg = CheckMessage
    Next i
   
End Function


Also changed i to a Long because it's the fastest type to use for loops.

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
PostPosted: Tue Sep 23, 2008 2:58 am 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
GIAKEN wrote:
Unfortunately, it won't work...it will only replace the last swear word in the string. Like this:

Msg = "shit whore fuck bitch" for example...

CheckMessage = "**** whore fuck bitch" but Msg is still the same so it will look for the second swear...so then

CheckMessage = "shit ***** fuck bitch" and then Msg will still equal the same thing...so you do:

Code:
Public Function CheckMessage(byval Msg As String) As String
Dim i As Long
   
    For i = 0 To UBound(SwearArray)
        CheckMessage = Replace$(Msg, SwearArray(i), ReplaceSwearArray(i), , , vbTextCompare)
        If CheckMessage <> Msg Then Msg = CheckMessage
    Next i
   
End Function


Also changed i to a Long because it's the fastest type to use for loops.


Ah true, thanks for that first fix, hadn't thought of that. And yeah, I thought of using I as a long for the loop, I'll probably do that :). Thanks for that mate :)

_________________
Image


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 7:53 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:19 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Econ


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:20 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
55.2


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:21 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Bett


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:22 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Bett


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:24 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Side


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:25 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Lieb


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:26 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Walk


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:27 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Jorg


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:28 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Juli


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:29 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Fair


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:30 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Bigb


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:32 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Prov


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:33 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Zero


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:34 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Weee


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:35 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Jame


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:36 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Xerx


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:37 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Dine


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:38 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Duns


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:39 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Full


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:41 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Kath


Top
 Profile  
 
PostPosted: Wed Dec 29, 2021 12:42 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489436
Plus


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1847 posts ]  Go to page 1, 2, 3, 4, 5 ... 74  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group