Author Topic: Making a page REFRESH  (Read 7946 times)

Alchemion

  • Guest
Making a page REFRESH
« on: October 14, 2008, 07:53:18 am »
Hi,

Got into a new situation that is good to be cleared out on this forum : the page refresh :)

If one needs a page to refresh at some time interval, how can s-he use (call for) the xajax functions that this game engine supports ?

For example, If I wish to refresh the "village.php" page, what code do I need to call the ajax or is it simpler with simple refresh meta and addnav village php ?...

Even with simple refresh meta + addnav, do I insert the code in the village.php or in the pageparts.php or elsewhere ?

Thank you.

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #1 on: October 14, 2008, 10:39:50 am »
You cannot use xajax to refresh a page, bluntly put.

AJAX sends HTTP requests and gets data back, just like you know from browsers (paging).
However, it is asynchronous and via javascript =) (hence Asynchronous Javascript....AX)

If you do so in lotgd, get an entire page OR do a request WITHOUT anonymous navs, then you get a badnav -> constantly.

AJAX is meant to put data into parts of the page on, i.e. button hit, or different JAVASCRIPT actions.

The current commentary is not AJAX because of the nav problems - I am unable to fix them currently because ALL the links on the REST of your page are old.

If you make new pagehits WITHOUT the override_allowed_nav then you have basically found a way for a user to "never time out" =)
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Making a page REFRESH
« Reply #2 on: October 14, 2008, 04:40:33 pm »
Quote
found a way for a user to "never time out" =)

 if we put a suplemental condition on timeout so that a script does the refresh and also checks if the player left the current page, being the same page with the one that needs refresh ?... if after x seconds, with or without refresh, the player has not left the refreshed page, the timeout is called and s-he gets it...

with or without xajax, I think it is doable... we can clear the ways of doing it, and the one with the skills should do the rest :D  :P




Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #3 on: October 14, 2008, 05:19:42 pm »
how do you know the player has left? =)

javascript runs client-sided... that's he issue.
The server does NOT check if a client is alive. =)

The issue is that lotgd was never designed to do that.

"call a timeout" won't work.. that would be deep core editing down to saveuser(); where the accounts information gets updated.

Sorry, but no chance I'll do that to break the thing apart =)
I did not do the commentary stuff for that reason  - for about 9 months now.
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Making a page REFRESH
« Reply #4 on: October 14, 2008, 10:20:19 pm »
Quote
how do you know the player has left? =)

in the same way you know you have left the game, though the game page is still open in your browser...

your simple inactivity more than  (ie.) 1800 seconds on the same (refreshed) page does get you to timeout... considering the amount of time, no single page is that interesting in any lotgd engine game so that it would keep you there focused  for more than 30 minutes... if you forgot the browser opened or not, you won't bother to relog again....

i see no problem here, nor any player....

Quote
that would be deep core editing down to saveuser();

i assume there is no great need in editing core... just inserting a countdown and compare the left countdown amount with the timeout from settings... if terms are equal or less, set the timeout as met and call for the apropriate store session functions ... i guess...

regarding editing saveuser.php :
any idea of the code needed to be changed?

thank you.
« Last Edit: October 14, 2008, 10:24:27 pm by Alchemion »

marjanovich

  • Guest
Re: Making a page REFRESH
« Reply #5 on: October 14, 2008, 10:37:24 pm »
Sticking my nose in... but if you really want a page refresh on a specific timer why not just cheat and...

Code: [Select]
<meta http-equiv="refresh" content="120;url=villiage.php">
The client is the timing mechanism so they'd see a refresh if idle every 2 minutes... If the client isn't there it would simply time em out like normal?

What exactly are you trying to refresh?

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #6 on: October 15, 2008, 05:58:48 am »
Quote
<meta http-equiv="refresh" content="120;url=villiage.php">
please "cheat" like this ;) will lead to constant badnavs.



Quote
in the same way you know you have left the game, though the game page is still open in your browser...
you mean the timeout that you override and start anew each "page refresh" ? =)

how can you say anything about "simple inactivity" ... =) you would need a server script that checks "has this player left the page.
I am anxious to see how you do this... :) because the navs would of course every hit be created anew... and then you will hack to override the "page refresh causes new timeout"...

Quote
i assume there is no great need in editing core... just inserting a countdown and compare the left countdown amount with the timeout from settings... if terms are equal or less, set the timeout as met and call for the apropriate store session functions ... i guess...
if you think so, just try it out =)
as you have to insert the countdown in javascript, you have just opened a nice security loophole to manipulate. =)

I have an idea what code to change - but I won't think it through, it is too ghastly.
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Making a page REFRESH
« Reply #7 on: October 15, 2008, 06:45:53 am »
Quote
you mean the timeout that you override and start anew each "page refresh" ? =)

well... got a new idea: we don't override the timeout, we are just enhancing it, we are improving it.... so, we will add a new condition in the game settings, so that the timeout is met when x time passes after lasthit OR when y time has passed and lastpage = previous page ... thus needing to have 2 lastpage variables: 1=lastpage and 2=previous page ...

this new added condition is suplemental and does not affect the core, but adds a new possibility to it...

what say you ?  :)

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #8 on: October 15, 2008, 08:05:58 am »
I say you're in for some deep fundamental stuff.

You can try to wrap your words around - but what you want is still the same.

It is a deep core hack to overthrow the current way which EVERY nav ingame is based on.
You need not only to make certain (!) the new system is as free of loopholes as you can, but also do hardcore coding in many lib files.

I won't do it. As I stated above.

IF I do the commentary, I will make it "pull the commentary only". I am NOT inclined to let entire pages refresh.

Why? How about that :) you get specials each page hit ... think: the entire code is executed again. including all hooks.
You can just sit+wait until you are in a special.

Your concept is only a concept, not thought-through and far from being implemented. :-/
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

marjanovich

  • Guest
Re: Making a page REFRESH
« Reply #9 on: October 15, 2008, 08:22:43 am »
And aren't buff/debuffs tick based? or just forest action based? An artificial reload would kill buffs/debuffs a bit prematurly

Alchemion

  • Guest
Re: Making a page REFRESH
« Reply #10 on: October 15, 2008, 09:16:26 am »
Quote
IF I do the commentary, I will make it "pull the commentary only". I am NOT inclined to let entire pages refresh.

In fact, this is the reason i started this post : to have refreshed commentary...

Please, lend a hand here...

Thank you.

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #11 on: October 15, 2008, 11:40:26 am »
I said "No". Sorry.

"Live" Commentaries are on my to-do-list, but not at a priority. There are other things like the caching system I need to fix up.

There is a difference between "lend me a hand" and "do the complete code for me". :(
That's why I always point you somewhere and give you examples, but now code it for you and then show you "this is how it looks like".
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Making a page REFRESH
« Reply #12 on: October 15, 2008, 01:01:13 pm »
I have to understand that the
Quote
complete code
is quite a lot of coding...

 I assumed is something simple, a couple of lines for a suplementary condition... the rest of 90% of the work would have been on my task: to fit the code, to test it and to get it to a good usable status...

you know better... anyway, developping a system by yourself is hard and time consuming and even stressing... unlike on DP, you have to handle all issues on your own... i understand your position...

whatever i am ABLE to do to ease your commitment to this community, don't hesitate to ask...

paypal button + god speed !



« Last Edit: October 15, 2008, 01:15:52 pm by Alchemion »

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 318
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Making a page REFRESH
« Reply #13 on: October 15, 2008, 01:19:12 pm »
If it were simple - I'd have just done it =)

One of my mottos: do small changes now, then you can safely forget them. It is more tedious to try to remember them / do a log of "TO DO" than to fix them.

However, when I stall something I usually have a good reason.

But it occurred that things I thought of being "design-breaking" were quite simple to do. They lay in my brain for some time until a solution popped up.

As the commentary is not being worked on for a few month, you can imagine it's not a trivial task.

Quote
unlike on DP, you have to handle all issues on your own... i understand your position...

Right, kickme handles coding issues and such things. =) That's it.
Others including the DP Team just say "No, we won't introduce that - it is against the spirit/the traditions/whatnot" =)

So basically it is not that different - except I honour open source as "you can change what you like - feel free" and answer questions on that freely.

Paypal would make me feel obligated - which I don't like as I distribute +nb because I have to release anyway =) and as others have also nice ideas - why not get feedback
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro