Algorithm Only Finds Vertical Path?
Jan 19, 2010
I recently started on an browser based MMORPG, I just found 1 major issue.I'm using these libraries
JS A* Algoritm ( http://devpro.it/code/137.html )
Jquery ( http://www.jquery.com/ )
Jquery UI (http://ui.jquery.com/ )
So I'm using a little piece of JavaScript code in which im accessing the AStar function. The downside is, the AStar algorithm only finds vertical tiles. (See screenshots below)
function mapmouse (obj) {
//Get the coordinates
coords = obj.id.split('_');
[code]....
If you choose a non-vertical path, var path gives an empty array (path.length = 0 )If I choose a vertical path, it's working as intended.
As you can see with this little test here, the AStar function itself is working properly (the libs.js is used by both the game and the example)[URL]
View 1 Replies
ADVERTISEMENT
Apr 13, 2010
I am trying to write a code that tells if one number is a multiple of another and I type in the numbers from a text box...
<html>
<head>
<script type="text/javascript">
[code]....
View 2 Replies
View Related
Apr 24, 2009
I would appreciate any help I can get about setting focus back to a textbox after my javascript validates that the input by a user into the textbox is incorrect. You can see my attempt at this towards the end of the javascript with - dateStr.Edate.focus(); I know the dateStr part is incorrect but not sure what other variable to use. Plus I am guessing I need to put the statement right before each false statement since there are different errors that can occur by the user. Additionally, I have two textboxes that I want the same javascript to validate. How does this affect setting focus to the appropriate textbox after an incorrect input. I am new to javascript so I hope my question makes sense. Thanks.
<HTML>
<HEAD>
<TITLE>Life Connection Program Survey</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function isValidDate(dateStr) {
// Checks for the following valid date format:
// MM/DD/YYYY
[Code]...
View 4 Replies
View Related
May 6, 2005
i am trying to store some shopping cart details in a cookie. I have been able to do that but i want to now retrieve the values and put them in a shopping cart table. An example of the cookie file is
Product1=value,Quantity1=value,Price1=value,Extras1=value;
Product2=value,Quantity2=value,Price2=value,Extras2=value;
I have been able to retrieve the 2 cookies
cookieArray = document.cookie.split("; ")
for(i=0; i<cookieArray.length ; i++)
{
document.write(cookieArray[i] +"<br>")
}
But now for each Product i want to retrieve the 4 values. Can anyoine help me with this or suggest a better way to achieve the same thing.
View 7 Replies
View Related
Oct 20, 2009
I want obsfucate and compress the code for my website (HTML, CSS but especially Javascript). Are there any industry standard algorithms that are recommended?
View 5 Replies
View Related
Aug 16, 2010
I've written a function that "condenses" a string if it is too long.
function shortenMsg(msg,maxLen){
if (msg.length > maxLen){
var over = msg.length - maxLen, // amount that needs to be trimmed
[Code]....
Each of the methods 1-3 is the amount that that specific method can trim from the string. I'd like to be able to trim as little as possible.
For example, if the string needs 5 characters to be trimmed, and method1 can trim 8 characters, but method3 can trim 6, then method3 should be used. If none of the methods can individually trim the string enough, then I'd like the optimal combination of the methods that will get the job done.
I can't figure out what sort of code structure I need for this (besides a ton of if/else statements). Maybe an array that contains each of the methods, arranged in increasing order....?
View 10 Replies
View Related
Oct 30, 2006
I need some ideas on how to compute the factorisation of a non-zero integer?
For example:
if the user input is 8, its factorisation is 1 * 2 * 2 * 2;
if the user input is -300, its factorisation is -1 * 2 * 2 * 3 * 5 * 5
Does anyone know?
View 3 Replies
View Related
Nov 2, 2004
Does anybody know of an algorithm to calculate mortgage payments? e.g.
Amount: 100,000
Interest Rate: 4.5%
Term: 25 Years
Monthly Payments: x
I've looked at other js scripts to do this but it seems alot more involved then I thought, and because they use non descriptive variable names I can't work any of them out..
View 1 Replies
View Related
Apr 27, 2009
I'm using a script to include images into a slide show using direct URLs to the image files, but I am using fckeditor (PHP) for my users to edit their content. The script in the .js file that pulls the images into the slide show.The user's image file is going to be named something like, "userImage01.php". Inside that file would be their image location path ~ "images/user/image1.jpg".Therefore, I need the above javascript to pull-in "userImage01.php" INSTEAD OF the image's location path.
View 10 Replies
View Related
Dec 5, 2011
I have an assignment to code a java class that plays rock, paper, or scissors. The class can access the history of past gestures played by both itself and its opponent, but nothing else. The class will be played against others in 10,000 matches and the winner will be determined via round robin format. Other than using a greedy algorithm to determine statistically the best choice from prior gestures and basic pattern recognition I have no decent ideas.
View 6 Replies
View Related
Jun 11, 2010
Does anyone know a way to do vertical sync with javascript animations (getting timers to run on the vertical sync)?
I rather doubt there is a way to do it, but I find it annoying that when I am dragging an object with my mouse that the object "tears" sometimes.
View 1 Replies
View Related
Jul 23, 2005
Is there a javascript variable that contains the path of the file from which
it ran?
Something like this....?
alert('My path=' + MyURLPath);
Is this possible?
View 4 Replies
View Related
Apr 26, 2005
Can I subtract the filename form the location.pathname ex:
Before = 'file:///c:/afolder/awebsite.html'
After = 'file:///c:/afolder/'
Or is there any other way to get the directory without the name of the file being veiwed?
View 1 Replies
View Related
Jul 23, 2005
I have the following directory structure
index.jsp
a.js
b.js
|
|--/templates
|
|--/blah.jsp
Now blah .jsp is included INSIDE index.jsp.
In blah.jsp I have a button that calls a function inside b.js.
In index.jsp I have following code inside head tags:
<script src="a.js"></script>
<script src="b.js"></script>
and I figured since blah.jsp is included inside index.jsp, I should be
able to access the javascript methods with ease. But its not happening
that way. I get an error (object expected in the line that has button in
it). BTW, its not a problem in my JS or JSP code, because if I put the
js file's contents inside blah.jsp, then it works like a charm!
So what am I doing wrong?
I also tried moving my script import statements inside blah.jsp as:
<script src="../../a.js"></script>
<script src="../../b.js"></script>
But this doesn't seem to work either?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
View 3 Replies
View Related
Jun 30, 2006
i just wanted to retrieve path of a file residing on local client
system using javascript
View 5 Replies
View Related
Mar 21, 2011
I'm having an issue using .get and a callback. Basically, unlessI use a fully quantified path when I deploy my site the call doesn't work. When I'm developing on localhost, the site works fine. It's an ASP.NET MVC site. I'm fairly new to jQuery. If I replace the code with an absolute path, all seems fine. Obviously I'd rather use relative paths. I'd be grateful for any insight you could offer.
[Code]...
View 2 Replies
View Related
Oct 29, 2010
why my code not work, when I change path of xml?,
$.ajax({
type:"GET",
url:"testPathxml.xml",
dataType:"xml",
[Code]....
View 1 Replies
View Related
Mar 19, 2009
I can't figure out why I am not able to read the cookies sitewide, maybe it is the way I am setting the cookie but the cookie looks to be set correctly in the Firefox browser.
On the page that I set the cookie, it works. I can read the cookies I set on the same page as well.
If I move to another page to view the cookies it gives an undefined value when using the getCookie function.
IF the problem lies in the getCookie function, please explain the code a little to me so I can get an understanding what I missed.
Code:
View 1 Replies
View Related
Feb 17, 2009
I set the cookie with out the path. Is it OK to leave the path if you want the path to be "/"?
Code:
I see i firefox if I don't set the path , for path I get "/" ..Seems like default is "/" . Not sure if all browswe will set it to "/" by default?
View 1 Replies
View Related
Jul 16, 2009
i have this web application in which the user has to browse and select a folder but not file. i used <input type="file"> , which helps in retrieving only files.
View 3 Replies
View Related
Oct 7, 2009
I don't normally use Javascript apart from a few browser workarounds, but I have a requirement to set a country cookie and it was working when all my pages were in the same directory, but now that I've added subdirectories, it sets a new cookie for each directory instead of one sitewide.
Here's the code (which I edited from some found on the internet):
Then on the homepage links I use:
Then on the subdirectory pages, I have a reset button which allows you to return to the homepage and disable the redirect.
So I just need the path=/ to be added somewhere is that right? I tried changing the last line of the main code to:
View 4 Replies
View Related
Apr 16, 2007
1. I have some links that open with Javascript. The HTTP links work just fine, but I have one link that is supposed to open a picture in a new window. The picture is stored in the root/images folder. So it's supposed to be a relative path, but no matter what I do, I get an error page. (images/snailmail.jpg)
2. I have added a mouserollover funtion to change a small picture on the page. I am trying to add a second function to that function, to stop the scrollbar in the lower left corner as long as the mouse hovers over the picture. For the first picture, it works fine, but with the 2nd picture which allready has a mouseover function, I am not sure what to do.
View 3 Replies
View Related
Jul 23, 2009
I need to delete the path from certain files using js.
For instance
Change: images/icons/picture1.png
To: picture1.png
View 1 Replies
View Related
Jun 2, 2009
I love it. For a project I need help with parent data parsing.
<ul>
<li><a href="#">Option 1</a>
<ul>
[code]....
View 1 Replies
View Related
Dec 2, 2003
I would like to go to a url based on what the user selects from three seperate pull down menus.
Example user selects a product. Then selects a month and Selects a year.
month and year would join together Then create a path
<a href="product/month_year/DEFAULT.HTM">
I this possible with javascript.
View 2 Replies
View Related
Dec 1, 2006
In short, is there any way to have a js file know the location on the server where it is stored.. I can only find the domain/location of the current web page URI.
Explanation:
I have a bunch of javascript and php files that are in one location and are shared across a whole bunch of subdomains (each on their own folder on the root). I call the script through a "scripts" subdomain (this is so all the subdomains can access them in one shot).
A couple of the js files are ajax incorporated and I want to call a php script. Obviously, I can't call to the "scripts" subdomain, nor can I use the root webserver (as it is detected as the calling subdomains root). The only thing I can think of is if I can call the php file RELATIVE to the JS file... but all I can seem to get is RELATIVE to the calling script, which won't work since the js file won't know where it's being called from.
View 1 Replies
View Related