cry of war Posted July 11, 2007 Share Posted July 11, 2007 I am making a game and I have a registration page where you sign for my game. I want to add a Javascript that takes each character of a text field, say for like a screen name, and gives it a value then it adds all the values assigned to the characters of the name so I can give them a special stat when they are with in such and such number Example Cry of War C=(some number) r=(some number) y=(some number) (space)=(some number) o=(some number) f=(some number) (space)=(some number) W=(some number) a=(some number) r=(some number) (All some numbers Added together)=(Some other number) If some other number is between 0 and 10 do such and such 11 and 20 do such and such and so on and so forth So do you guys think you can help me??? And would the JavaScript think that C R Y is different from c r y if something like this would work? Quote Link to comment Share on other sites More sharing options...
Azu Posted July 11, 2007 Share Posted July 11, 2007 If javascript can tell the number of the character from the encoding, then it should be able to add them all up without even needing a list of all their values in the script. Not sure if it can or not though. I know PHP can. Quote Link to comment Share on other sites More sharing options...
cry of war Posted July 11, 2007 Author Share Posted July 11, 2007 <html> <head> <script type="text/javascript"> var x Name = new String("the text or what ever from the text field goes here some how???") Name = Name.split("") for (x in Name) { document.write(Name[x]+"<br/>") } </script> </head> <body></body> </html> This is what i have so far seems to be working i almost get the effect i want all i have to do now is find a way to switch the Letters to numbers or if some one could help me with the php AZU was talking about that would be much appreciated CoW Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.