Jump to content

I have no idea what to call this


cry of war

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

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.