Kniggles's Recent Forum Activity

  • That would be as simple as creating a text variable and setting it to: Text1.text&Text2.text and then setting text2 to the variable..

    I'm not sure if it can be done without the variable step inbetween, but this way it should for sure..

    just found a setting that says 'wrapping' so thought i change it from 'word' to 'character' seems to of givin me a free weekend twiddling me thumbs now.

    thanks LittleStain

  • I thought that was what you were trying to achieve, for I don't understand why your text should have issues..

    Here's a small capx with text append, would this work?

    With your help we have sorted the newline,

    17 characters per line then newline,

    just trying to work out how to append to the front of the text,

    I can not open your capx as i am not running the same v az you yet.

  • Thank you, LittleStain

    that returns each text2 out on a newline,

    so now need to find the happy medium ,

    thinking a sub to count the number of characters

  • Hi All,

    This weekend I shall mainly be trying to work out how to Append text to a new line and in reverse order,

    Scenario =

    Text Object = Text1

    Text Object2= Text2

    onclick- Append Text2 with Text1

    result wantted text1 = 1 text2=1

    next: text1=2 text2= 12

    next: text1=3 text2= 123

    ect.

    I have this already working in construct2 HOWEVER-

    after the 1st line is full the text object gos blank, I have made the text object bigger on both axis to no joy,

    my thinking is this:

    either

    1- count how many characters make a line then after that many hits try and add the new line break in , however i can see a problem later on when it comes to 2 characters numbers , <this is where i am at on this part.

    the other bit would be to text2 =321 , would this be achieved by making a new variable 'x' and Append text1 to that and then work out how to print that out into text2 ?

    Have a great weekend,

  • I am working on this as well,

    I am working along the lines of having 2 layers and to variables 1 for password and 1 for player name

    layer 1 having 2 text box, 1 name 1 password and a button.

    on click variables 1 and 2 are set from textboxinput1 and 2 ,then ajax is called and fills an array,

    if right layer 1 disappears and the player id name score .ect and filled

    I am stuck on the ajax line this is where i am at with it.

    [quote:169869x5]"http://mywebsite.com/getscoresPLAYERone.php?username=" &playerName & "password=" &password

    and how to make it check as it seems to just carry on no matter what password is put in.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've also worked out my problem too

    I'm used to C2, where I create an object and it just remains in memory as an object forever. I think PHP works like other languages, where the object will be garbage-collected unless you still have at least one reference to it. So in my case, I'm creating an array of objects and then looping through the array to find what I need. It's not as easy as C2 or BASIC but it's useful to learn anyway. I might make most of my game in PHP and just the front-end in C2.

    I am just almost quite nearly there started to explore that which an array is,

    can you not just scroll though one in C2 by a +1 function / button

  • Which part isn't working? How are you retrieving the C2 post, are you using isset? I always post my data in the 'data' part of the AJAX box, and then retrieve it in PHP with something like $data = file_get_contents("php://input"); which will put the C2 'data' box in a variable called '$data'. Then I split it to retrieve what I need.

    As I said, I'm new to this, spent the entire day trying to work out how I manipulate my loaded objects in PHP (I can retrieve them from my database and put them into objects, but I can't work out how to select different objects in PHP).

    I got the bit i was looking for working, , am trying to adapt it now .

    When you say you want php to select different objects would you like to expand ?

  • Changed the mysql to read

    ----------------------------------------------------

    $sql = mysql_query("UPDATE bogger SET hits = hits+1 WHERE ID =$ID ");

    WORKS to add 1

    -----------------------------------------------------

    $sql = mysql_query("UPDATE bogger SET hits =$hits WHERE ID =$ID ");

    WORKS to add whats in the box

    ----------------------------------------------------

    C2 Ajax POST reads

    "http://mywebsit/update.php?ID=" &ID.Text & "&hits=" & hits

    =====================================================================

  • I have now go to the part where i get the return "Congrats Your Data was saved",

    HOWEVER when I go an look into the base nothing at all has changed. I did once get the error "Your data was not passed" and I sorted that so there must be data being passed and the right data,

    The .Php line Now reads

    -------------------------------------------------------------------------------------------------

    $sql = mysql_query("UPDATE MyTable SET hits = hits WHERE ID = ID ");

    -------------------------------------------------------------------------------------------------

    And the C2 Ajax Post box reads

    ---------------------------------------------------------------------------------------------

    "http://mywebsite/update.php?ID=" & ID.Text & "&hits=" & hits.Text

    ---------------------------------------------------------------------------------------------

    I decided to add the one to the hits on a different button , so I am thinking dose the Ajax take the number from the text box when asked or from the array that it used to fill the text box in the first place , in which case I would need to change where the hit is recorded and not any of the lines above,

  • I think i allmost have it , thanks for bearing with me farflamex ,

    I now have the Ajax reading

    "http://fish.net/fishnetFolder/PlussONEupdate.php?ID=" & ID.Text

    and the .php file reads

    $sql = mysql_query("UPDATE `$db`.`myTable` (`hits`) VALUES ('+1') WHERE ID=('$ID') ;");

    I think I have to many ; in there. and i am thinking VALUES should be something like VALUES =('hits =hits+1')

  • I'm in a similar stage to you, so I may be able to help. I've been working away at communicating with a database for the past week, so I'm still in the early stages, but I'm able to retrieve info, update it etc, just the basics.

    From what I understand, you want to send a value from C2 to your database, to update it, presumably that value has already been collected from the database earlier?

    So (you probably know most of this), if you already have your value in C2 and want to send it to your database, you need to POST (not update), I think. Actually I'll be honest, I haven't even looked at the method section yet. All I do in your situation is, I send the information in the data, using the default method, then collect it in my PHP file and do the MYSql work in PHP. It's fairly simple, just takes a bit of getting used to (PHP isn't very complicated anyway, just taking me a while to get the hang of the syntax).

    thats the bit i am stuck on , how do i send which Id in the base I want to post/update

  • Have you looked at this tutorial? Should get you started.

    https://www.scirra.com/tutorials/346/on ... -php-mysql

    Hello farflamex,

    That is the one I am playing with.

    I have got down to " Parameters for AJAX: Post to URL " box and find there is now an extra Variable in it to fill in and am stuck on the code to post into them,

    Tag "wotever" < this is the local Handel to tell the difference ajax events .

    URL: " http://tomysite.com/plus1update.php" < the php file that adds One

    Data " ID.Text " < this is the integer of the Players ID so Ajax knows which ID in the base to update. {this i am now not sure is right}

    Method "UPDATE" <- this I am Guessing at.

    any ideas ?

    thanks.

Kniggles's avatar

Kniggles

Member since 2 Dec, 2013

None one is following Kniggles yet!

Connect with Kniggles

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies