Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | | #ludumdare on irc.afternet.org (Info)

Ludum Dare 29 — April 25th-28th Weekend [9 PM EST] — Theme: ??? (Slaughter Ends Soon!)
  • Ludum Dare 29 Compo Begins: in 9 days, 5 hours, 51 minutes, 32 seconds
  • Ludum Dare 29 Jam Begins: in 9 days, 5 hours, 51 minutes, 33 seconds
  • [ MiniLD 50 | Warmup Weekend April 19th-20th | Real World Gatherings | Ludum Deals | Wallpaper ]


    even MORE about multiplayer (players & messages!)

    Posted by
    July 28th, 2012 11:30 am

    //i hope you guys liked my previous scripts,for we shall be coding in GML. if you experince errors in the compiler
    //like, “PROGRAM ENDS BEFORE END OF CODE” it means you have one too many programs. other than that lets get
    //started shall we? this script is about players and handling with them. because its soo short we will
    //throw in some more commands on messages.

    //to see how many players are on a session,along with a certian name, you would do the following:
    {
    mplay_player_find();
    mplay_player_name(a_number);
    }

    //note that in order to do this you MUST use mplay_player_find(),else it will not work.

    //to find the ID of that certian player,use the following code
    {
    mplay_player_find();
    mplay_player_id(a_number);
    }

    //now onto messages.messages are pre-programmed strings the will be sent to a player instance.
    //but enough of that! lets get programming! lets start on a personal message sent to a player.
    //it would look like this: (use 0 to send it to all players)
    {
    mplay_message_send(player,id,message);
    }
    //to make sure its sent to it,you would use the following code:
    {
    mplay_message_send_guaranteed(player,id,message);
    }
    //this next code will have you “recive” messages from other players: (use 0 for any message)
    {
    mplay_message_receive(player);
    }
    //now we can tinker with this abit.the next following code can be used to do diffrent things with the message:
    {
    mplay_message_receive(player);
    mplay_message_id(); Returns the identifier of the last received message.
    mplay_message_value(); Returns the value of the last received message.
    mplay_message_player(); Returns the player who sent the last received message.
    mplay_message_name(); Returns the name of the player who sent the last received message.
    mplay_message_count(player); Returns the number of messages left in the queue from the player (use 0 to count all message).
    mplay_message_clear(player); Removes all messages left in the queue from the player (use 0 to remove all message).
    }
    //there you have it! if your eager to see more code ill be happy to show you just simply post a comment
    //down below and ill see how it goes!

    4 Responses to “even MORE about multiplayer (players & messages!)”

    1. jellonator says:

      Just thought I would let you know, but Mplay is very insecure, which can often cause viruses.

    2. Gaggerzon says:

      I suggest posting this in the game maker community forums instead of here.

    3. LiteLab says:

      Use the code tags.

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]