1 round behind

Location of the Videos
Post Reply
User avatar
Kirbie
Posts: 33
Joined: Sun Apr 11, 2010 5:44 pm

1 round behind

Post by Kirbie »

Has anyone noticed that you are 1 round behind on taking and recceiving damage. I also noticed the the bank ( which the bank tut is cool) is also a round behind on showing a trans action. Is there any way to make these action a real time with out clicking twice or refreshing to get correct amount?
Image
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: 1 round behind

Post by Jackolantern »

Welcome to PHP :) If you want real-time, you will have to use a client-side technology such as Javascript/AJAX. PHP is server-side, so to get new info you have to hit the server and refresh the page, so it is going to appear as though it is one round behind.
The indelible lord of tl;dr
User avatar
Kirbie
Posts: 33
Joined: Sun Apr 11, 2010 5:44 pm

Re: 1 round behind

Post by Kirbie »

Works for me.....thanks
Image
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: 1 round behind

Post by Jackolantern »

I think some of Halls' video tutorials cover some Javascript and AJAX. I know that his games he has released the code for use AJAX pretty extensively, so even if it is not in any of the videos yet (check the Urban Realms videos to see if any is in there), you could at least study it a bit and possibly customize it for your uses :)
The indelible lord of tl;dr
User avatar
Kirbie
Posts: 33
Joined: Sun Apr 11, 2010 5:44 pm

Re: 1 round behind

Post by Kirbie »

I will have a look into that. thanks
Image
Gustava
Posts: 66
Joined: Tue Dec 29, 2009 5:49 am

Re: 1 round behind

Post by Gustava »

I ran into this a while back and didn't like how it appeared to lag, so I just recalled it right before it was supposed to post.

Call it,
Calculate,
Recall it,
Post to page.

So say it's 1 round behind on giving you damage. The damage will be 5. *shrugs*

I'm guessing you have something like

Code: Select all

$userhp="SELECT from user_stats where yada yada'"; To retrieve their stats
$battle_damage = 5
$userhp = $userhp - $battle_damage
Your hp: $userhp
Rough example. So that's calling it, calculating, and posting to page. To make it real time just add this in,


$userhp="SELECT from user_stats where yada yada'"; To retrieve their stats
$battle_damage = 5
$userhp = $userhp - $battle_damage
$userhp="SELECT from user_stats where yada yada'"; To retrieve their stats - Updates whatever you calculated
Your hp: $userhp

I don't really know if that's good code practice or not but it has been working fine for me for as long as I can remember.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: 1 round behind

Post by hallsofvallhalla »

yes just call the display code after you update it. So update then query then display.
Post Reply

Return to “Older Browser MMO Videos”