My examples Forum Home > Construct 2 General > How do I....? |
Post Reply
|
Page <12345> |
| Author | |
Post Options
Quote Reply
Posted: 18 Jan 2012 at 7:19pm |
|
|
OK i got this working, but where and how do i have to put my variables for user:
I want this: When level is finished -> display text field where user could enter their name -> and when hitting enter the hiscore board is displayed with actual score and name of that user. Now i've got only this and don't know how to replace NEWENTRY and 1337 for variables: "post.php?name=NEWENTRY&score=1337" "readscores.php?num_scores=10" |
|
![]() |
|
Post Options
Quote Reply
Posted: 18 Jan 2012 at 11:53pm |
|
|
you should add a Text box on your layout where the player will enter his name, and on click on the validation button, you will send an Ajax request that will look like :
|
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 2:08pm |
|
|
Thanks Yann, with your fantastic help I was able to get it right, but now I have another question.
I want to do this hiscore thing with spritefont plugin, but scores are displayed inline(player1,30,player2,50...and so on) with that plugin and i don't have to say that it looks bad. How to make them display in block like in normal font. |
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 2:17pm |
|
|
haha inline, inblock, you talk like a css guy.
Well, I'm not sure how your datas are returned by your php script but you should either return them with "\n" at the end of each line, or with a special character. For example if you use "|" you can do
Edited by Yann - 20 Jan 2012 at 2:17pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 5:37pm |
|
|
Yes I know that inline and block was in css, and i thought that it describes the situation quite well:D
I must doing something wrong. When i put your code in event sheet everything is good, but no results in game, hiscores still displays in one line and not in a block. This spritefont is a plugin i have found in this forum. It's a sprite, so i think i can't append text to it :( Anyway here are my screenshots, I hope they are allowed here. First is this Spritefont object events(they are not mine, they were in example of usage) ![]() second are the request to php ![]() and the third is your Ajax condition, on my events: ![]() I checked the post.php file, and it has this "\n" at the end Edited by sled - 20 Jan 2012 at 5:40pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 7:23pm |
|
|
You are obviously not using the spritefont plugin
|
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 9:14pm |
|
|
hey @Yann thanks for cleaning up the gesture.capx a bit :)
|
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 9:16pm |
|
|
@ize, Whilst your here
What do i need to add to the PHP to get the rank of the player? I know it orders them but if i wanted to display the rank? thanks. |
|
|
In memory of flash :'(
|
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 9:18pm |
|
|
to be honest i never got that far :)
you'd have to write your own function to sort the array either in php or in c2 |
|
![]() |
|
Post Options
Quote Reply
Posted: 20 Jan 2012 at 9:27pm |
|
|
ahhh ok i'll have a look online
|
|
|
In memory of flash :'(
|
|
![]() |
|
Post Reply
|
Page <12345> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |