Jump to content

Recommended Posts

Hey,

 

I hope this is a common problem and don't have to post all of my code. Anyway i made a tile map which auto refreshes with setinterval every couple of seconds. It checks the database for other players in the vicinity. But often when i click the map (which makes a popup with some actions to perform) nothing happens.

 

Any thoughts what this might be and how to fix it?

Link to comment
https://forums.phpfreaks.com/topic/223850-weird-mouse-click-reaction/
Share on other sites

It will help us to understand your problem if you give detailed information about this with code. nobody knows how you are refreshing page with cron , popup or in iframe. even we dont know which map you are using API or something else.

Well i'm using settimout (not setinterval, srry mistake) from java within that i'm calling a jquery function to communicate with PHP and the mysql db. The tilemap is generated with PHP and some tiles are fetched from the database.

 

Currently the player can move around, center, scroll and dock into a station by clicking on a tile wich gives a popup with the available actions. But sometimes if i click it does not pop up, most of the time it does but there are moments i have to click several times before that popup shows. I think it has to do with the "setinterval" but im not sure.

 

The page refreshes with the setimeout which cals a php page that queries the server and load the new generated map into my map div. Like this:

 

<script>
			function turnlistener()
			{
				 $.post('flightscript.php', {
				go: 'first'}, 
				function(data)
				{
					$('#flightcontroll').html(data);
				});
					   
				$('#map').load('mapgenerator.php');						   
			};						
			$(function() {
				setTimeout('turnlistener()', 1000 );
			});
	</script>

 

flightscript.php sets the destination the player wants to go in the database. Then mapgenerator.php generates the tiles that need to be displayed. Once the script finishes it loops again so every second (  setTimeout('turnlistener()', 1000 );  ) the map refreshes to see if there is a player nearby, or an NPC which need to be implemented yet.

 

-edit-

If things are still unclear on what map i'm using, i'm generating my own using tile divs with a fixed size and float them next to eachother within a map div with a fixed size. Currently you can only see 11x11 tiles.

 

Hope this helps.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.