Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 12:12 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  [ 1405 posts ]  Go to page 1, 2, 3, 4, 5 ... 57  Next
Author Message
 Post subject: Optional Censoring
PostPosted: Fri Sep 19, 2008 7:51 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Difficulty: ?/5 - It's not a direct C&P tutorial. I tried to explain things, but I don't have a copy of MS4 on my laptop currently so this will try to explain things as best as possible.

< CLIENT SIDE >

Make a new check box object on frmMirage. This will let players turn censoring on or off for themselves. Now double click the check box and add this:

Code:
Call SendData("censor" & END_CHAR)


Now where the packets are checked, add this:

Code:
If Parse$(0) = "censor" Then
        If Val(Parse$(1)) = 3 Then
            frmMirage.chkCensor.Enabled = False
            frmMirage.chkCensor.Value = 0
        Else
            If frmMirage.chkCensor.Enabled = False Then frmMirage.chkCensor.Enabled = True
            frmMirage.chkCensor.Value = Val(Parse$(1))
        End If
        Exit Sub
    End If


< SERVER SIDE >

Find where the player is logged in. It should be something like "LoadPlayer(Index, Name)". Add this to that section:

Code:
If CENSOR_ON = 1 Then
                        Call SendDataTo(Index, "censor" & SEP_CHAR & Player(Index).Censor & END_CHAR)
                    Else
                        Call SendDataTo(Index, "censor" & SEP_CHAR & 3 & END_CHAR)
                    End If


Now find where all the packets are handled in the server. Add this to the list of Case's:

Code:
Case "censor"
       
                If CENSOR_ON = 1 Then
                    Player(Index).Censor = Not Player(Index).Censor
                    Call SendDataTo(Index, "censor" & SEP_CHAR & Player(Index).Censor & END_CHAR)
                Else
                    Call SendDataTo(Index, "censor" & SEP_CHAR & 3 & END_CHAR)
                End If
                Exit Sub


Open the Data.ini file and under MAX add: CENSOR=1

Now here's the magic function, in modGeneral (or wherever) add this:

Code:
Public Function CensorShip(ByVal Index As Long, ByVal Sentence As String) As String
Dim I As Long

    CensorShip = Sentence

    If CENSOR_ON = 1 Then
        If Player(Index).Censor = 1 Then
            For I = 1 To TOTAL_CENSOR
                CensorShip = Replace$(Sentence, Censor(I).Find, Censor(I).Replace, , , vbTextCompare)
                If CensorShip <> Sentence Then Sentence = CensorShip
            Next I
        End If
    End If

End Function


Add this at the top of a module:

Code:
' Censoring data
Public CENSOR_ON As Byte
Public TOTAL_CENSOR As Long

Type CensorRec
    Find As String
    Replace As String
End Type

Public Censor() As CensorRec


Find where the server is initialized (ServerInit?) and add this:

Code:
CENSOR_ON = GetVar(App.Path & "\Data.ini", "CONFIG", "CENSOR")
   
    If CENSOR_ON <> 0 Then
        I = 1
        Do
            If GetVar(App.Path & "\Censor.ini", "CENSOR" & I, "Find") = "" Then Exit Do
            I = I + 1
        Loop
       
        TOTAL_CENSOR = I - 1
       
        ReDim Censor(1 To TOTAL_CENSOR)
       
        For I = 1 To TOTAL_CENSOR
            Censor(I).Find = GetVar(App.Path & "\Censor.ini", "CENSOR" & I, "Find")
            Censor(I).Replace = GetVar(App.Path & "\Censor.ini", "CENSOR" & I, "Replace")
        Next I
    End If


This will be the piece of data in the player's collection that will tell if they want to see censors. In "PlayerRec" add this:

Code:
Censor As Byte


Now in SavePlayer, add this after it sets the player's password:

Code:
Call PutVar(FileName, "GENERAL", "Censor", Trim$(Player(Index).Censor))


Now in LoadPlayer, add this after it gets the player's password:

Code:
Player(Index).Censor = Val(GetVar(FileName, "GENERAL", "Censor"))


I'm not exactly sure where all the chat is handled, because this wasn't made for MS4. So wherever the server sends the chat to the client, you need to wrap the variable with the CensorShip function. Example: In MapMsg you'll see a loop and something like "Packet = "mapmsg" & SEP_CHAR & Msg ..." Change the Msg to: Censorship(I, Msg).

Since we have each player able to turn the censoring on or off, we have to go directly inside the subs that send out the message so that it can use the function in the loop.

Also make a new Censor.ini file where the Server.exe is and paste this inside the file:

Code:
[CENSOR1]
Find=fuck
Replace=****
[CENSOR2]
Find=bitch
Replace=*****
[CENSOR3]
Find=shit
Replace=****
[CENSOR4]
Find=cock
Replace=****
[CENSOR5]
Find=dick
Replace=****
[CENSOR6]
Find=pussy
Replace=*****
[CENSOR7]
Find=ass
Replace=***
[CENSOR8]
Find=cunt
Replace=****
[CENSOR9]
Find=twat
Replace=****
[CENSOR10]
Find=whore
Replace=*****

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 8:07 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Just saw a problem and fixed it :D

I was looking it over and noticed that it would only censor one word. So I changed:

Code:
If CensorShip <> Sentence Then Exit For


To:

Code:
If CensorShip <> Sentence Then Sentence = CensorShip

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 8:18 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Faaail.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 8:44 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Yeah that's true...I like to over complicating things :? I like everything to be in the server. Also this won't take away hardly any server power...

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:21 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Well I just tested the function against:

fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckshitshitshitshitshitshitbitchbitchbitchbitchbitch

And turned censor on and off and both returned 0 ms.

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:29 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
The actual function CensorShip (since that's all that the server requires extra work) from when it starts to when it ends. Time = GetTickCount, MsgBox GetTickCount - Time

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:32 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
GIAKEN wrote:
The actual function CensorShip (since that's all that the server requires extra work) from when it starts to when it ends. Time = GetTickCount, MsgBox GetTickCount - Time


Awww, you already know your game is gonna fail so hard you think only one person is going to be talking at once?

Set up 80 connections, all spamming it :D

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:36 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Well if each time they enter a message that takes the server less than a millisecond to process the censoring with then I doubt they would be able to even get the server to take a full second of processing unless they can send more than 1000 messages...

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:46 pm 
Offline
Persistant Poster
User avatar

Joined: Fri Aug 15, 2008 3:11 pm
Posts: 633
wouldnt this be good
if you make it add 1 to the ini with thier name
and if it is over a certain number it mutes them"?"

_________________
╔╗╔═╦═╦══╦═══╗
║║║║║║║╔╗║╔═╗║
║║║║║║║╚╝║║║║║
║╚╣║║║║╔╗║╚═╝║
╚═╩╩═╩╩╝╚╩═══╝


╔╦═╦╦════╦═══╗
║║║║╠═╗╔═╣╔══╝
║║║║║║║║╚═╗
║║║║║║║║╔═╝
╚═╩═╝╚╝╚╝ ?


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Fri Sep 19, 2008 9:48 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
doomteam1 wrote:
wouldnt this be good
if you make it add 1 to the ini with thier name
and if it is over a certain number it mutes them"?"


No because the point is to let them choose if they want words to be censored or not.

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

Image
Image


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Wed Dec 01, 2021 7:43 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffuserhttp://semiasphalticflux.rusemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchuckинфоtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimate.rutemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:10 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
XIII


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:11 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
49.6


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:12 pm 
Online
Mirage Source Lover

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


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:13 pm 
Online
Mirage Source Lover

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


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:14 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Blaw


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:15 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Paul


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:17 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Inke


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:18 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Dona


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:19 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Alis


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:20 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Vive


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:21 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Nina


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:22 pm 
Online
Mirage Source Lover

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


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:23 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Wisa


Top
 Profile  
 
 Post subject: Re: Optional Censoring
PostPosted: Mon Dec 27, 2021 7:24 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489261
Ster


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 39 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