Master Game Community

Master Game Productions (MGP) presents Master Game Community (MGC). A forum for all your Game Maker needs.


    i want help withe program

    Share

    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    i want help withe program

    Post by kasm on Fri Jan 28, 2011 11:44 am

    i had making program ( top secert ) but i had issue : i want box you can write u email and probleam and send it to my email now how can i do this??

    need help as fast as can Very Happy

    i want read example
    i am begginer in this program so i had big probleam to udnerstand 39dll and htttp request
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Fri Jan 28, 2011 11:50 pm

    Basically, you need to find a webhost with e-mail support (such as 000webhost); create a free domain, then use the online file manager to upload a php file, with something like...
    Code:
    mail($_POST['email'],$_POST['subject'],$_POST['message'],0,0);
    For argument's sake, call it send_mail.php

    Then, in GM, use 39dll and HTTPRequest like...
    Code:
    dllinit(0, true, true);
    var email, subject, message;
    email="myemail@example.com";
    subject="Test Subject";
    message="Message!";
    HTTPRequest("yourdomainhere.com","send_mail.php","POST",0,"email="+email+"&subject="+subject+"&message="+message);

    Look up the mail() function here.

    Good luck.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 1:28 am

    ok i created free website with e-mail support and i uploaded the php script :
    ( mail($_POST['email'],$_POST['subject'],$_POST['message'],0,0)Wink and the name of the file is send_mail.php as you want


    then i open gm and i maked a new script and pasted this script :

    dllinit(0, true, true);
    var email, subject, message;
    email="myemail@example.com";
    subject="Test Subject";
    message="Message!";
    HTTPRequest("yourdomainhere.com","send_mail.php","POST",0,"email="+email+"&subject="+subject+"&message="+message);

    and i change like yourdomainhere.com to what i want ...
    now how to make a box for wirte and what to name it


    Last edited by kasm on Sat Jan 29, 2011 1:31 am; edited 1 time in total
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 1:30 am

    Run it? Then check your email inbox. Your host should forward the message to the email address you provide.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 1:35 am

    i change like yourdomainhere.com to what i want ...
    now how to make a box for wirte and what to name it

    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 1:36 am

    That's a bit more complicated. Check to see that the current code actually works prior to making the input box.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 1:46 am

    i run it and they give me this error


    ___________________________________________
    COMPILATION ERROR in Script: script0
    Error in code at line 1:
    dllinit(0, true, true);
    ^
    at position 1: Unknown function or script: dllinit
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 2:10 am

    1. It's not meant to go in a script. It goes into the Create event of an object.
    2. You need to add both the 39dll scripts and the HTTPRequest script.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 3:36 am

    they give me error :

    ___________________________________________
    FATAL ERROR in
    action number 1
    of Create Event
    for object object0:

    COMPILATION ERROR in code action
    Error in code at line 1:
    dllinit(0, true, true);
    ^
    at position 1: Unknown function or script: dllinit


    can u give me ready example gmk and i will test it on my website and i will merage it withe my program
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 3:58 am

    If you imported the 39dll scripts into your game, you wouldn't get that error!

    I won't give you a .gmk, as it's not hard to do. Just go to Scripts (top) and choose Import Scripts..., then choose the 39dll scripts (I don't know if it's still called that, but for me it's called Dllscripts.gml)

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 4:12 am

    i loADED DLLSCRIPTS.GML AND I run the program they give me this error :


    ___________________________________________
    FATAL ERROR in
    action number 1
    of Create Event
    for object object0:

    COMPILATION ERROR in code action
    Error in code at line 6:
    HTTPRequest("yourdomainhere.com","send_mail.php","POST",0,"email="+email+"&subject="+subject+"&message="+message);
    ^
    at position 2: Unknown function or script: HTTPRequest
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 4:16 am

    Now, find the HTTPRequest scripts on GMC, and import those; then the code will work.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 4:45 am

    i did't find HTTPRequest in the fourms ?
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 4:52 am

    Here are the two scripts you'll need...
    HTTPRequest...
    Code:
    /*  HTTPRequest()
    **  by Kolink
    **
    **  General form: HTTPRequest(server,file,method,mode,data)
    **
    **  Argument list:
    **    argument0 (server): Server IP or domain name
    **    argument1 (file):  File to get on the server
    **    argument2 (method): "GET" or "POST" - request method
    **    argument3 (mode):  Data mode - 0 for ASCII and 1 for Binary
    **    argument4 (data):  POSTdata in urlencoded form (optional)
    **
    **  Usage: Returns data from the server or "0" on failure.
    */
    var sockId, newline, processHeader, firstWord, code, retVal;
    sockId = tcpconnect(argument0,80,0);;
    if (!sockId) {
        return "0";
    }
    newline = chr(13)+chr(10);
    setformat(sockId,1,newline);
    clearbuffer();
    writechars(argument2+" /"+argument1+" HTTP/1.0"+newline);
    writechars("Host: "+argument0+newline);
    //writechars( "User-Agent: My-Game"+newline); // It's usually a good idea to give your game a User Agent string
    if (argument2 == "POST") {
        writechars("Content-Type: application/x-www-form-urlencoded"+newline);
        writechars("Content-Length: "+string(string_length(argument4))+newline);
        writechars(newline);
        writechars(argument4);
    }
    else {
        writechars(newline);
    }
    sendmessage(sockId);
    processHeader = true;
    while (processHeader) {
        receivemessage(sockId);
        firstWord = readsep(" ");
        switch(firstWord)
        {
            case "HTTP/1.0": //response code
                code = readsep(" ");
                if (code != "200") {
                    show_message("HTTP "+code);
                    return "0";
                }
            break;
            case ""://blank line
                processHeader = false;
            break;
        }
    }
    setformat(sockId, 2);
    retVal = "";
    while(1) {
        size = receivemessage(sockId, 6000);
        if (size > 0) {
            if (argument3) {
                retVal += readcharsasbytes(size);
            }
            else {
                retVal += readchars(size);
            }
        }
        else {
            break;
        }
    }
    closesocket(sockId);
    return retVal;

    readcharasbytes...
    Code:
    //Binary-safe version of readchars
    var str;
    str = "";
    repeat (argument0) {
        str += chr(external_call(global._BufG, argument1));
    }
    return str;

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 4:53 am

    where to but this script
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 4:58 am

    Make two new scripts and call them what they are. So call HTTPRequest, HTTPRequest.

    Simple.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 5:05 am

    i do that they gie me this error


    ___________________________________________
    COMPILATION ERROR in Script: HTTPRequest
    Error in code at line 60:
    retVal += readcharsasbytes(size);
    ^
    at position 24: Unknown function or script: readcharsasbytes
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 5:10 am

    Oops... readcharasbytes is missing an s. It should be readcharsasbytes.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 5:15 am

    they give me now :
    ___________________________________________
    COMPILATION ERROR in Script: HTTPRequest
    Error in code at line 60:
    retVal += readcharsasbytes(size);
    ^
    at position 24: Unknown function or script: readcharsasbytes
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 5:17 am

    It's the same error... You obviously didn't rename it correctly. That's the only reason that it would of occurred.

    -MoK


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 5:31 am

    what to reneme the script or the error
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 5:34 am

    The script. The error wouldn't occur if the script has named correctly.

    -MoK

    PS: I deleted your duplicate post.


    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 5:37 am

    witch script to change the name

    kasm
    Member

    Posts : 17
    Reputation : 0
    Join date : 2011-01-28

    Re: i want help withe program

    Post by kasm on Sat Jan 29, 2011 5:38 am

    oh shit i did it i guess it work
    avatar
    MasterOfKings
    MGC Master

    Posts : 67
    Reputation : 0
    Join date : 2010-04-01

    Re: i want help withe program

    Post by MasterOfKings on Sat Jan 29, 2011 5:47 am

    I'll let you off here, but please avoid swearing and double posting. Both of which are offenses to MGC's rules.

    -MoK


    Sponsored content

    Re: i want help withe program

    Post by Sponsored content


      Current date/time is Wed Nov 22, 2017 9:46 am