View Full Version: Using SOC

Graphics Requests Galore > Coding > Using SOC


Title: Using SOC


smarttart62 - March 28, 2005 08:28 PM (GMT)
Ok this tutorial is made to help you make chat things with SOC ;)

What is soc?
Soc (Simple Online Communication) is a new DLL by The_Stephen. Using winsock, soc allows you to make MMO's with EASE!

The Basics -
To start out, put this in a create event:
CODE
soc_connect("ONLINEname"); //Connects to ONLINEname
global.name=get_string("What is your name?",""); //Gets the users name
global.last=""; //Sets global.last to nothing


Then, on a press enter event we put this code in:
CODE
soc_token_send(global.name+": "+keyboard_string); //Sends a token (to everyone) of the keyboard string

keyboard_string=""; //Resets the keyboard_string


On a draw event place this code...
CODE
if (soc_token_receive()) //Checks for a message
{
global.last=""; //Resets global.last (Used to show the last message)
global.last=soc_token_value(); //Gets the token
}
draw_set_color(c_yellow); //Sets the color to yellow
draw_text(2,10,"You: "+keyboard_string); //Draws "You:" and then the keyboard string
draw_set_color(c_red); //Sets the color
draw_text(2,30,"Last:"); //Draws the text "Last:"
draw_text(10,50,global.last); //Draws the last message


And there! You just created a simple (but not so functional) chatroom!
Next up... Advanced chat room! ;)

Oh, and BTW, i used this for an MMO im making, BUT i just re-did my chat room a little. Now the chat looks much nicer... ;)

Coded entirely by,
-Steve

smarttart62 - March 28, 2005 11:34 PM (GMT)
Ok look at My_MMO posted in the GM games section, and you can see how i modified the code i gave in the first post, to make my mmo ;)
-Steve

JJProductions - March 29, 2005 02:13 PM (GMT)
I like it! :D

My friend ( Who has NO idea on how to use GameMaker ) Keeps bugging me to make a MMO or MMORPG, this really helps.

I just have one question,
Say that you are using SOC, and you connect to a server. Will other players be able to see your player automatically? As in, I am hosting a game and playing, and another person joins, will he/she be able to see my character walk around automatically or is there another code for this?

Also,
What do you put under the ONLINE part? (First line)

smarttart62 - March 29, 2005 07:52 PM (GMT)
This code ONLY allows you to make a simple chat thing to be implemented into your game. However, soc comes with a help file AND a .gm6 for making mmo's... Check out the zip file and u'll see :P
-Steve




* Hosted for free by InvisionFree