Jump to content

Dynamic Forms Help


Selacius

Recommended Posts

At the moment, for me to create map sets for my RPG game I must change the tiles one at a time. I am looking for a script which allows me to select which tiles I want to change and then also what I want them changed to. Once I submit this form, then I will have a code that changes each tile. Now, the way I've thought of doing it is to have each tile as a link which when selected will add 2 input boxes (x and y coordinate), with the values for the tile. Now, once I reclick the tile, if its already selected then I would like the 2 input boxes pertaining to the tile to be removed. Any help would be awesome.

Link to comment
Share on other sites

I want it so that when I click the images (individual tiles), 2 input boxes will be displayed on a pop up. The 2 boxes will correspond to the x and y coordinate of the tile. Now, when I click the image again, I want the 2 input boxes related to that image to be removed.

Link to comment
Share on other sites

What about using prompt boxes, would that do?

<html><head><script type="text/javascript">function move(){var newTopPosition=prompt("enter new position from top","");var newLeftPosition=prompt("enter new position from left","");newTopPosition=parseFloat(newTopPosition);newLeftPosition=parseFloat(newLeftPosition);var x=document.getElementById('pic').style;x.top=newTopPosition;x.left=newLeftPosition;}</script></head><body><p>click on google to reposition</p><img style="position:absolute;top:100px;left:100px" id="pic" src="http://www.google.co.uk/intl/en_uk/images/logo.gif" alt="Photo" onclick="move()"></form></body></html>

If not i'm sure that with the examples blue and I have posted you will be able to figure it out. :)

Link to comment
Share on other sites

Not really sure what you're asking for to be honest! I've whipped up this:

<script type='text/javascript'>function createBox(obj){	var x = document.getElementById('map' + obj)	var y = document.getElementById('span' + obj)		x.innerHTML = (x.innerHTML == 'Clicked') ? 'Click' : 'Clicked';	y.style.display = (y.style.display == 'none') ? 'inline' : 'none';}</script><table id="rpgMap" width="400" height="120">	<tr>  <td width="50%" vAlign="top"><a href="javascript:createBox(0)" id="map0">Click</a><br /><br /><span id="span0" style="display: none">X: <input size="6" /> Y: <input size="6" /></span></td>  <td width="50%" vAlign="top"><a href="javascript:createBox(1)" id="map1">Click</a><br /><br /><span id="span1" style="display: none">X: <input size="6" /> Y: <input size="6" /></span></td>	</tr></table>

If it's not what you're wanting, do a quickie in Paint and we'll see what we can do.

Link to comment
Share on other sites

Not really sure what you're asking for to be honest! I've whipped up this:
<script type='text/javascript'>function createBox(obj){	var x = document.getElementById('map' + obj)	var y = document.getElementById('span' + obj)		x.innerHTML = (x.innerHTML == 'Clicked') ? 'Click' : 'Clicked';	y.style.display = (y.style.display == 'none') ? 'inline' : 'none';}</script><table id="rpgMap" width="400" height="120">	<tr>  <td width="50%" vAlign="top"><a href="javascript:createBox(0)" id="map0">Click</a><br /><br /><span id="span0" style="display: none">X: <input size="6" /> Y: <input size="6" /></span></td>  <td width="50%" vAlign="top"><a href="javascript:createBox(1)" id="map1">Click</a><br /><br /><span id="span1" style="display: none">X: <input size="6" /> Y: <input size="6" /></span></td>	</tr></table>

If it's not what you're wanting, do a quickie in Paint and we'll see what we can do.

That is exactly what I am looking for. But, it has to use images in both instances. Also, if possible, I'd want it to display the text boxes in a new window. The map itself is composed of smaller 20x20 images arranged in a grid, with the current script, the text boxes are displayed near the image, but what I'd like to do is have these boxes displayed as i said, on another page (all on the same) or after the image map. Also, another requirement is that the values for the tile (x and y) are actually put in the input box.
Link to comment
Share on other sites

It's going to get a bit complicated here though isn't it? What happens if someone enters the same x & y co-ordinates for two tiles? Does it have to update the position of the tile in the map after clicking? How will the user tell where it is?At the moment, i've got an image in my head of say.. 4 tiles.. you click one of them and it pops up a box with the current x and y co-ordinates of the tile in ( say.. 1, 1), and you can change it and hit save or reset, or click the tile again to close the box. Not sure what happens after the box "saves".Am I going in the wrong direction?

Link to comment
Share on other sites

It's going to get a bit complicated here though isn't it? What happens if someone enters the same x & y co-ordinates for two tiles?  Does it have to update the position of the tile in the map after clicking? How will the user tell where it is?At the moment, i've got an image in my head of say.. 4 tiles.. you click one of them and it pops up a box with the current x and y co-ordinates of the tile in ( say.. 1, 1), and you can change it and hit save or reset, or click the tile again to close the box.  Not sure what happens after the box "saves".Am I going in the wrong direction?

Yes you are. The script is for the back-end admin portion of my game. It will only be used by admins to make the maps used by my game. The reason I am doing this is because, at the moment I set up the size of the map, then a script outputs the map, with just a basic tile (grass), and inputs this information into the database. So why I want this script is so that I can mass change tiles. The actual x,y coordinates will not be changed by the user (me) but will serve as a reference to which tiles have been selected at the moment. After I've selected the tiles to be changed, I will have a drop down list which has the options of the tiles that it can be changed to. Once I hit the submit button, it will take me to a new page which for every tile selected, it will update the required database entry.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...