Jump to content

Interactive Map


e4games

Recommended Posts

So I want to make a interactive map....it will be nothing special (for right now) so I want it (when you click on it) to either say "you didn't find a pokemon"...or say "you found a pokemon" So I want it to display a key...like pokemon12 but I want it to increase everytime someone gets the "you found a pokemon" (I mean the number at the end to increase) and then mail it to me.....this is the code I have so far....how can I make it do the rest of what I want it to do

<html><head><script type="text/javascript">function mouseOver(){document.getElementById("b1").src ="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" Width="400" Height="400";}function mouseOut(){document.getElementById("b1").src ="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" Width="400" Height="400";}</script></head><body><img border="0" alt="Search Map!" src="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" id="b1" width="400" height="400" onmouseover="mouseOver()" onmouseout="mouseOut()" /></a></body></html>

Link to comment
Share on other sites

not php, unless you want to do a random image map or something... could do a javascript onclick function and find the location of the mouse on the image and see if it matches up to whatever you want... might have php as well though

Link to comment
Share on other sites

i guess you could give certain areas of the map their own statistical probability wherein it will factor greater or "lesser" to their odds of catching a pokemon. For instance, one square you might have a 50/50 chance, but another square you might only have a 20% chance.

Link to comment
Share on other sites

So I added more to the code its now-

<html><body><button onclick=<html><head><script type="text/javascript">function mouseOver(){document.getElementById("b1").src ="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" Width="400" Height="400";}function mouseOut(){document.getElementById("b1").src ="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" Width="400" Height="400";}</script></head><body><img border="0" alt="Search Map!" src="http://www.pokemondb.co.uk/images/maps/mt-moon/ground.png" id="b1" width="400" height="400" onmouseover="mouseOver()" onmouseout="mouseOut()" /></a></body></html{<p>You didn't find a pokemon :(<p>}else{<p>You found a darkrai! Please Post the code Darkrai13 below on the forum</p></body></html>

Look at it on one of the w3schools things were you can post code and it shows the output...I can't get it not to show the output code only when you click on it...also I want the code to increase by 3 everytime

Link to comment
Share on other sites

</body></html {<p>You didn't find a pokemon :(<p>}else{<p>You found a darkrai! Please Post the code Darkrai13 below on the forum</p></body></html>

The code you posted doesn't make any sense

Link to comment
Share on other sites

Actually, I just found your button element within your code. The onclick event handler is meant to run Javascript. You can't just write a pile of HTML inside an attribute.

Link to comment
Share on other sites

It's going to take some careful and thoughtful planning for what you want to do. Basically though, you're going to have to decide what exactly this maps ultimate objective is supposed to be. From what I gather, you want to have a map that people click on, and it tells them something and gives them an output and then sends you that result. All of this will require a couple of languages for each aspect of the task. The webpage and (image)map will be HTML/CSS. To handle users when they interact with the map you will need javascipt, and to send the information to yourself, probably some PHP. The hardest part in my opinion will be developing the javascript and how to decide what exactly will happen based on users clicking on the map. for instance, you could make every click return a random number, and that number could be interpreted (based on your definitions) to give a result in accordance with what you want to happen based on the number being returned. For instance on a scale of 0-9, having a number 0-3 will result in no pokemons, 4-6 will result in 1 pokemon, and 7-9 will result in 2 pokemons. Or certain regions of the map can be predetermined to only return specific types of results leaning towards giving more or less pokemon. This is all up to you, but a computer will not do it for you. You literelly have to break your ideas down into very specific steps based on cause and effect. "If 'this' happens, then 'do this'" kind of stuff. I think you should explain more of the theory behind your intended project as you are still very new to basic coding in general and write it down. It'll be easier for us to help you if we know where you're coming from, and for us to see exactly what your thought process is. I'm not sure if English is your first language or not, (if it isn't please ignore this) but you should write out your sentances a little more clearly, they can be very hard to follow at times. :)

Link to comment
Share on other sites

If the obtaining of the Pokémon is done solely with Javascript, anybody could cheat by typing their own Javascript in the navigation bar. I'd send a request to PHP using AJAX and let PHP decide what the user finds.Either way, it's not something you can do if you don't understand Javascript

It's going to take some careful and thoughtful planning for what you want to do. Basically though, you're going to have to decide what exactly this maps ultimate objective is supposed to be. From what I gather, you want to have a map that people click on, and it tells them something and gives them an output and then sends you that result. All of this will require a couple of languages for each aspect of the task. The webpage and (image)map will be HTML/CSS. To handle users when they interact with the map you will need javascipt, and to send the information to yourself, probably some PHP. The hardest part in my opinion will be developing the javascript and how to decide what exactly will happen based on users clicking on the map. for instance, you could make every click return a random number, and that number could be interpreted (based on your definitions) to give a result in accordance with what you want to happen based on the number being returned. For instance on a scale of 0-9, having a number 0-3 will result in no pokemons, 4-6 will result in 1 pokemon, and 7-9 will result in 2 pokemons. Or certain regions of the map can be predetermined to only return specific types of results leaning towards giving more or less pokemon. This is all up to you, but a computer will not do it for you. You literelly have to break your ideas down into very specific steps based on cause and effect. "If 'this' happens, then 'do this'" kind of stuff. I think you should explain more of the theory behind your intended project as you are still very new to basic coding in general and write it down. It'll be easier for us to help you if we know where you're coming from, and for us to see exactly what your thought process is. I'm not sure if English is your first language or not, (if it isn't please ignore this) but you should write out your sentances a little more clearly, they can be very hard to follow at times.
You could separate your wall of text into a few paragraphs.
Link to comment
Share on other sites

So I think I deiceded what I'm going to do, So I am going to make the image show up...then do a SEPERATE icon and when you click on it 1 out of 9 chances are you'll find a pokemon and 8 out of 9 chances you won't...and then just send it to bewamsley@comcast.net...I want it only to send it to me if the code displays that the user found a pokemonIf you got the code "You found a pokemon" I want them to be able to type in the username...then send it to me....The map will be completely seperate and what you will be clicking on is just a icon

Link to comment
Share on other sites

wait...I said that wrong....I want (when the person gets the "you got a pokemon" code) to make it so a special code sends it to me like anything randomly like "fk4ugf98" anything like that, but I want it to display the code you got a pokemon then do the code gflgjk578 or something like that...I want the code to change everytime (I mean the radom letters and numbers)

Link to comment
Share on other sites

so I looked over the javascript lesson over and over again, but still it doesn't say any where how to make it so when you click something this happens OR this happens and it doesn't say any where how to make it so theres a 9/10 chance you will get something and a 1/10 you won't.....this is what I think it need to be...the condtional operator...this is what it is "variablename=(condition)?value1:value2"....am I right...if I am how am I supposed to do it..like whats the condition and variable name and how would I get value 1 to be more often to say it then value 2?If I'm wrong please tell me what I have to use

Link to comment
Share on other sites

so I looked over the javascript lesson over and over again, but still it doesn't say any where how to make it so when you click something this happens OR this happens and it doesn't say any where how to make it so theres a 9/10 chance you will get something and a 1/10 you won't
You have all the resources you need, you just have to do the thinking.This function gives a random number: http://w3schools.com/jsref/jsref_random.aspThe Javascript tutorial teaches you how to program in Javascript, it does not teach you how to think. You're taught that at school. Take the information you have and put it together like a puzzle to obtain what you want.
Link to comment
Share on other sites

So, there's a way to rename the numbers (of the math random) to be phrases?This is what I think that code should be (part of it)

<html><body><script type="text/javascript">document.write(Math.random());if(==0.1548765298165728){document.write(you found something)}</script></body></html>

Link to comment
Share on other sites

So, there's a way to rename the numbers (of the math random) to be phrases?This is what I think that code should be (part of it)
<html><body><script type="text/javascript">document.write(Math.random());if(==0.1548765298165728){document.write(you found something)}</script></body></html>

Have you read the Javascript tutorial?You should look through it. Learn what variables, functions, statements and operators are. The document.write() method is not any use for this situation because all it does is print something on the screen.
Link to comment
Share on other sites

I understand variables, functions, statements, operators...trust me, I've looked threw javascript 5 times!!!!!!! No where does it say how to make it so it either displays that code or the other code....it only says how to display 1 code....thats why I asked!!!!! I know how to display ONE code

Link to comment
Share on other sites

I understand variables, functions, statements, operators...trust me, I've looked threw javascript 5 times!!!!!!! No where does it say how to make it so it either displays that code or the other code....it only says how to display 1 code....thats why I asked!!!!! I know how to display ONE code
I was asking if you understood those things, because this line does not make any sense:
if(==0.1548765298165728)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...