Ribis's Recent Forum Activity

  • I guys can someone help me here??

    see i have 3 options in my game...

    the player can start a new game from scratch

    the player can save and load the game

    and i have an option to go back to me main menu... the thing is...

    what can i do if the player starts a new game after loading the game once or after playing for a while.. becuase the variables and the progress overall (doors unlocked, walls destroyed, items collected, etc etc) will be already done if the player starts a new game. what can i do to reset ALL to default when the player choose click start new game??.

    i was thinking to make a save when the menu shows up... and if the player clicks on the option "go back to main menu" load the state that i saved later to set everything to the way it was when the game started... but... what if the player deletes that save slot from the game's documentation?? i dont have a clear solution to this... <img src="smileys/smiley5.gif" border="0" align="middle" />

    what its the proper way and good tips and recommendation you can give me???

    i dont want to force the game to be close... only to be run again to go back to the original state...

    Thanks!!!

    <img src="smileys/smiley2.gif" border="0" align="middle" />

    I don't know, but you can reset the variables if the player click "new game" or "reset" in the options while the player is playing the game, and after this action make a fast savegame to replace the new variables...

    About the savegame, I resolve the general problems to save in my database (online) to save all data of the player. if the player like to reset the game, construct2 will reset all of the variables and will save in the same row of the database. you need to make some "loader" before the game start, because you could make some bug...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ribis - get the text you want with ajax, then separe a value that you want for each variables

    example:

    1? - Request a text "100|1|2|" from an url using Ajax

    2? - On Completed Ajax Request

       - Then set "Healt" variable value to tokenat(AJAX.LastData,0,"|")

       + set "Point" variable value to tokenat(AJAX.LastData,1,"|")

       + set "Level" variable value to tokenat(AJAX.LastData,2,"|")

    thank you, is working perfectly, with this I make my script better than before, but I have another question, if I have one text like this:

    100|20|0|0|0

    200|50|20|0|0

    90|10|20|20

    it's possible to organize the variable for the newline? I mean, with this I have to make 5 text and I made 5 different file in php... if I can use one text line for all of my variable will be perfect, because I will use just one file in php... I can use the same method for one line, but if in the future I add something in my database i need to edit all order, would be a little bit confused...

    Thank you very much again

  • from the php file, I can load a value from the database.

    when the php file generate the value, I can load in construct2 with AJAX and show the echo in my project.

    so, if I use "|", like:

    10 | 100 | 1 | 2 |

    how i can set the variable in construct2 like this:

    healt: 100;

    point: 1;

    level: 2;

    etc..? I don't know how i can do in construct2...

    thank you very much

  • Hi everybody,

    I have a frustrating problem about how I can load a single row from my database in my array to set the different value in specific variable in construct2...or with a differen method...

    Actually, I can show in contruct2 all of the value from the row in the database like this:

    "10""100""300""10""300""...ecc

    or:

    '10'200'300'400... ecc,

    when I load in construct2 with AJAX, I don't know what I can do to use a single row for set all of the variable in construct2...

    somebody have some idea? construct2 can recognize a single value from "" for example?

    Thank you very much

  • In the How do I FAQ, section AJAX :

    How do I pull variables out of a PHP page using AJAX ? - LINK

    In the tutorials:

    AJAX example with Construct2; Online High Score Table (AJAX, PHP, MySQL).

    thask for the reply, I follow this example but doesn't work, I didn't understand the logic...

    now is working, but if I use the:

    <?php

    header('Access-Control-Allow-Origin: *');

    require 'gold.php';

    echo $gold;

    ?>

    the variable in construct 2 will be "NaN"

    gold.php is this:

    <?php

    header('Access-Control-Allow-Origin: *');

    require 'facebook_login.php';

    ///////////////////

                         ? if ( $loadspecific == "caricadati" ) {

            $query = "SELECT goldDB FROM tabletest WHERE UIDfacebook = $id";

            $result2 = mysql_query(mysql_real_escape_string($query)) or die (mysql_error());

            while($row = mysql_fetch_array($result2))

            {

                  ?//echo "\\";

                

                  ?$gold = "{$row['goldDB']}" ;

                  ?//echo $gold;

                  ?

                  ?//echo $_GET['gold'];

            }

            }else{

                //echo $result;

                }

    ?>

    I start to make a project with facebook... now my project save the data from facebook API in my database and load the single information in the database (gold.php)

    now my problem is load the variable in Construct2 because in php is working

    i'm thinking if the problem is "while($row = mysql_fetch_array" but the echo will be a single number like "1111", but Construct2 doesn't load the variable if I insert require 'facebook_login.php'; <img src="smileys/smiley19.gif" border="0" align="middle">

    the variable is from my database...

  • Hi everybody,

    I made a code in php for save some variable in php, the file is this:

    <?php

    $variable1= 100;

    $variable2 = $variable1;

    ?>

    I know this forum is not for php, but the problem is when I try to read the variable in construct2 with ajax because i don't understand the logic of construct 2.

    i need to set one variable in construct2 with a $variable2 of php file.

    the file:

    .capx

    .php file

    thank you so much, I really need to understand that, actually i spent 4 hours for that <img src="smileys/smiley19.gif" border="0" align="middle">

  • ok, I made a picture of my idea:

    <img src="http://www.apophisgame.com/TABLE.png" border="0" />

    when one user will register on my game, the php will make a new row for all of the table with the ID of the user.

    when someone save the game, the variable will save in all of the table.

    it's possible this scheme?

    could work?

    Thank you!!

  • Hi everybody,

    I have a good question because I am a little bit confused about the savegame on construct2...

    if we like to make some GDR ( a lot of items, life, power...etc..) we need to savegame all of the data, the maps( where is player on the map, what he miss...etc...)

    I tested the local savegame and it's working... the problem is when I remove the cache from the computer...(bye bye savegame)

    now, i don't know how work the google store (if it has some special folder for the app (like a folder where all files are save ..etc)

    now, I need to now the best system to make a local savegame, for don't delete the savegame from by mistake... because when I save the game, if i delete the cache I will lost all of the data!!

    Thank you!!!

    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Maybe you should view some tutorials on PHP and MYSQL before you tackle something like this?

    http://www.w3schools.com/php/

    http://www.w3schools.com/php/php_mysql_intro.asp

    Thank you for the links,

    I will publish some idea about the php and the options of the database soon...

  • Yes, I think about that...

    every users have item1,item2... with a different row to setup the item...

    my problem is the php, I now how I can make the logic "system", but when I think how I can write the code in php grow up a big problem...

    for example, it's possible to make a code on the MYSQL, or on php, to recognize when the database have a new user and for that the database will make all of the rule for new users? like make a row for item1,item2,life,point,score....etx (off course it's possible, but i don't know how I can write the code in php, and insert on construct2...)

    I don't know how I can write the code to write on the database (like edit a item when the user save the game...etc <img src="smileys/smiley5.gif" border="0" align="middle" />

    Thank you so much!!!

  • Glad it worked! <img src="smileys/smiley1.gif" border="0" align="middle" />

    You could further security by encrypting the passwords inside the MYSQL database, and make the AJAX post parameters more complex then password or username.

    Just to name a few things.

    Thank you for the suggestion, I never use the PHP or the MYSQL for this case, for me it's very difficult...

    I love to understand this topic (mysql, php...) because for me it's difficult and I need that for make my game...

    have a savegame on the database with login, customize avatars...etc will be fantastic...

    I just find a few topics about this topic...

    Do you think it's good idea to save the items, avatar, variable of user... in one row? or it's good to make a new table for this case?

    Thank you!! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Hey Ribis,

    Try using this example I scrounged up-

    Make sure you have a web server, such as WAMP server on your local computer.

    Be sure to use the SQL document and import it into PhpMyAdmin or what ever MYSQL administration you use.

    Export and upload your project, as well as the PHP files.

    The test username and password should be: test01

    https://www.dropbox.com/s/8nqacjhm2otwrun/RegisterLogin.zip

    thank you so much!!!

    it's working!! It's just what I needed!! easy example!!

    now, I need to study the PHP for make safe the database from some attack and add some information like a e-mail..etc

    I found

    Subscribe to Construct videos now

    how it's possible to make a safe login/register...etc etc

    I think it's good idea to adabt this example for construct2...

    Have a savegame system on the database with a username/pass/e-mail it's very important!

    Thank you again! <img src="smileys/smiley1.gif" border="0" align="middle">

Ribis's avatar

Ribis

Member since 22 Oct, 2012

None one is following Ribis yet!

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies