Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

In-Game Consoles?


Asuma

Recommended Posts

Okay, you know in a online when you cheat. yo see about the five lines. When you type, you line pops up at the bottom, while the top line disappears.

Like this

CooGuy:He's a cheater!

Hitbabe: Yeah, I saw him!

Redman55: I aint cheat!

n00b: ye he aint cheat!

You: I saw both them cheat!

Hitbabe: Yeah, I saw him!

Redman55: I aint cheat!

n00b: ye he aint cheat!

You: I saw both them cheat!

*Admin has kicked Redman55

Redman55: I aint cheat!

n00b: ye he aint cheat!

You: I saw both them cheat!

*Admin has kicked Redman55

*Admin has kicked n00b

Like that.

Link to comment
Share on other sites

Ok, here's some pseudocode (Meaning I'll show you the logic, but you'll have to apply it yourself).

The objects:

CLIENTTEXTBOX = The text box the client (you) types your message into

CHATBOX = A text area that displays 3 lines and automatically scrolls down when content is added

Variables:

CLIENT = The client user

CLIENTNAME = The client's username

CLIENTMESSAGE = The message the client sends

SERVER = The server controller

SENDERNAME = Name of the message sender

SENDERMESSAGE = Message the server relays to the other users

Client-Server Model


===Clientside:===

//This handles sending the message to the server
//Note: "\n" is a line break
CLIENTTEXTBOX is in focus,
CLIENT presses Enter:
+CLIENTMESSAGE = CLIENTTEXTBOX.Text
+Send CLIENTNAME to SERVER
+Send CLIENTMESSAGE to SERVER
+Set CHATBOX.Text to (CHATBOX.Text + "\n" + CLIENTNAME + ": " + CLIENTMESSAGE)
+Clear CLIENTTEXTBOX

//This handles recieveing the message and displaying it
CLIENT recieves message:
+Set CHATBOX.Text to (CHATBOX.Text + "\n" + SENDERNAME + ": " + SENDERMESSAGE)

===Serverside:===

//Recieves a message, sends it out to all other users
SERVER recieves message:
+SENDERNAME = CLIENTNAME
+SENDERMESSAGE = CLIENTMESSAGE
+Loop through all users, excluding the sender { Send SENDERNAME to CLIENTs; Send SENDERMESSAGE to CLIENTs; }
[/CODE]

Client-Client-Client-... Model (i.e. DirectPlay)

[CODE]
CLIENTTEXTBOX is in focus,
CLIENT presses Enter:
+CLIENTMESSAGE = CLIENTTEXTBOX.Text
+Loop through all other users {Send CLIENTNAME to SERVER; Send CLIENTMESSAGE to SERVER}
+Set CHATBOX.Text to (CHATBOX.Text + "\n" + CLIENTNAME + ": " + CLIENTMESSAGE)
+Clear CLIENTTEXTBOX

//This handles recieveing the message and displaying it
CLIENT recieves message:
+Set CHATBOX.Text to (CHATBOX.Text + "\n" + SENDERNAME + ": " + SENDERMESSAGE)[/CODE]

As you can see, the only difference with the client-server model is that the client sending the message handles what the server does. Ask me if you need any more help.

Link to comment
Share on other sites

You can change font and color in the text blitter setup dialog ( Options tab->Generate). Since its a bitmap font blitter, you can import bitmap fonts, which can have multiple colors, and use that too. Its also possible to swap colors via events. And if you want, you can use it as a sprite engine too :D

Its absolutely one of the better extensions out there. Very flexible, very easy, and very very useful

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...