Mirage Source
Guess-The-Phrase System - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13)
+------ Thread: Guess-The-Phrase System (/showthread.php?tid=2640)



Guess-The-Phrase System - KruSuPhy - 21-03-2009

Credits to Giaken for Helping me make the packet and most of the complicated stuff Tongue
Credit to Me for doing the easy stuff that I didn't need help with xD


Kay. First Tutorial. Sorry If I miss something ;D
BEFORE ANYTHING:
Go to \Data\ (Server Folder)and Add an INI File called phraselist.ini. This is how you're going to change the phrase easily without having to go into the server coding.
In the INI File, Put:
Code:
[PHRASE]
Phrase=thisisthephrase
---------------
Okay, Make a new form called frmGuessPhrase. This is going to be where the player puts and sends the Word/Phrase. Add a textbox(txtPhrase) and a Command button(cmdEnterPhrase)

Next, Go to modInput. Find;
Code:
' Whos Online
Case "/who"
     SendWhosOnline
(Or any of the other Player Commands, That is)
Add This Under it:
Code:
' Show Phrase Form
Case "/phrase"
     frmGuessPhrase.Show
This Is going to make the frmGuessPhrase appear when the user types '/phrase' into chat

Next, We're going to make the Packet in the Client.
In ModEnumerations, Find;
Code:
Public Enum ClientPackets

At the very bottom of that list, Add;
Code:
CPhrase

Now, To send the packet to the Server, Go back to frmGuessPhrase, Double click your Command button, And add;
Code:
Call SendData(CPhrase & SEP_CHAR & txtPhrase.Text & END_CHAR)
txtPhrase.Text = vbNullString
The Call SendData code will send the phrase to the server to be checked.

SERVER-SIDE

Go to ModEnumerations, Find:
Code:
Public Enum ClientPackets


Again, at the bottom, Add:
Code:
CPhrase

Go to ModHandleData, And find the list of Case (Whatever).
At the bottom of it, Right before the Case Else, Add;
Code:
Case CPhrase
Call HandlePhrase(Index, Parse)

At the very bottom of the module, Add:

Code:
Private Sub HandlePhrase(ByVal Index As Long, ByRef Parse() As String)
Dim phrase As String
    phrase = GetVar(App.Path & "\Data\phraselist.ini", "PHRASE", "Phrase")
    
    If Parse(1) = phrase Then
        Call PlayerMsg(Index, "You got it right!", Green)
        Call GiveItem(Index, 1, 500)
        Else: Call PlayerMsg(Index, "You got it wrong!", Red)
    End If
End Sub
What it does:
Dims phrase as a string. I put the path of the INI File in. You don't have to do this, You can just put If Parse(1) = GetVar(App.Path &....). I did it this way because it seems easier in my head. The If Parse(1) = Phrase Then Checks to see if the Phrase the player entered matches the phrase in your INI File. If they get it right, It will send them a Green PlayerMsg Saying they got it right, And Assuming gold is your Item 1, IT will send 500 Gold to them. The Else is If they put the wrong phrase in, IT will Send them a Red PlayerMsg Telling them they got it wrong.




-------------
I think thats it. If It goes wrong, PM me what happened and I'll fix the tutorial. Again, Credits to Giaken for helping me make the packet and get it to send back and forth between server and client.


Re: Guess-The-Phrase System - William - 21-03-2009

Ey, this is a awesome idea. Skip the item award. And create a new stat or skill or whatever and call it knowledge. Now you need to guess phrases right in order to gain knowledge points. This knowledge points allows you to go on with quests and getting in to secret areas and such.


Re: Guess-The-Phrase System - KruSuPhy - 21-03-2009

o; Shweet Idea. I might totally look into that xD
Not only would that be awesome, It'd be even awesomer If I did it. xD
Total Ego boost ;P


Re: Guess-The-Phrase System - William - 21-03-2009

Eventually if you stick around long enough you will learn to do way more than just this Smile


Re: Guess-The-Phrase System - KruSuPhy - 21-03-2009

Yea That's the idea.
I've got my handy dandy MSN and Giaken Added, And I'm sure If i beg enough He'll help me when i need it xD


Re: Guess-The-Phrase System - Robin - 21-03-2009

Harold can't even sanatize his own packets. Don't listen to him.


Re: Guess-The-Phrase System - GIAKEN - 21-03-2009

With Bomberman I was lazy a while ago...it's been a couple of months since most of it has been made.


Re: Guess-The-Phrase System - KruSuPhy - 22-03-2009

Robin Wrote:Harold can't even sanatize his own packets. Don't listen to him.
Well I don't see your MSN addy anywhere around here, So I guess I'll just deal with him.


Re: Guess-The-Phrase System - Mattyw - 22-03-2009

KruSuPhy Wrote:
Robin Wrote:Harold can't even sanatize his own packets. Don't listen to him.
Well I don't see your MSN addy anywhere around here, So I guess I'll just deal with him.

Psst. robinperris@hotmail.com.


Re: Guess-The-Phrase System - KruSuPhy - 22-03-2009

Hurry up and edit your post before you get your testies ripped off!


Re: Guess-The-Phrase System - Robin - 22-03-2009

Mattyw Wrote:
KruSuPhy Wrote:
Robin Wrote:Harold can't even sanatize his own packets. Don't listen to him.
Well I don't see your MSN addy anywhere around here, So I guess I'll just deal with him.

Psst. robinperris@hotmail.com.

Ha-HA! Changed my MSN, bitch.


Re: Guess-The-Phrase System - Mattyw - 22-03-2009

DAMN.

I should've suspected this when I saw:

Quote:Robin is leaving.
Leave me a message for details.



Re: Guess-The-Phrase System - KruSuPhy - 22-03-2009

xD Back to Giaken.


Re: Guess-The-Phrase System - Joost - 29-03-2009

Spammng a certain phrase with my g15 keyboard to get 500 gold a second, not a bad idea Big Grin.


Re: Guess-The-Phrase System - KruSuPhy - 29-03-2009

Phrase Limit ftw.
Too bad I haven't put it in the tutorial yet.


Re: Guess-The-Phrase System - Noobz - 02-04-2009

this is awesome! i might use it in my game for guessing a quiz.


Re: Guess-The-Phrase System - Robin - 02-04-2009

Should take away 500 gold if they get it wrong.


Re: Guess-The-Phrase System - Jacob - 02-04-2009

You should also have a huge list of strings that it can randomly pick one from. When the current one gets guessed, it picks a new random one.


Re: Guess-The-Phrase System - KruSuPhy - 03-04-2009

Robin Wrote:Should take away 500 gold if they get it wrong.
I haven't added anything else to the tutorial(i.e wrong answers and limit)
But in my source I have it where they lose 1000. Max Limit is 1 for every week(Which is when it should be changed, Weekly.)

@Dugor:
I was going to have a Hint system.
Picking a random phrase out of the blue isn't exactly what I'd call fair at all. But hell, None of us are fair I don't suppose. I just have a Hint thing.