             -==============================================-
              -=                                          =-
              -=           Phantasy Star Online           =-
              -=          Section ID Calculator           =-
              -=       Version 0.7      12 December 2001  =-
              -=                                          =-
              -=              by SuperSteve               =-
              -=                                          =-
              -=     email: supersteve1440@yahoo.com      =-
              -=                                          =-
              -=                Homepage:                 =-
              -= http://www.geocities.com/supersteve1440  =-
              -=                                          =-
              -=       Size: 18594 Bytes--(18.1 kB)       =-
              -=                                          =-
             -==============================================-


           ___________________
          < Table of Contents >
           
          < 1. Introduction >

          < 2. Updates, Version History >

          < 3. What Are The Possible Section IDs? >

          < 4. How Does PSO Calculate Your Section ID? >

          < 5. C++ Source Code For A PSO Section ID Calculator >

          < 6. JavaScript PSO Section ID Calculator >

          < 7. PHP PSO Section ID Calculator >

          < 8. The Complete ASCII Character Table >

          < 9. The PSO Software Keyboard Layout >

          < 10. Credits, Contact Info, Copyright Info >




===============================================================================
                   _________________
                  < 1. Introduction >
                   
===============================================================================

This guide is meant to bring order and understanding to the calculation and
assignment of section IDs in Phantasy Star Online (PSO).

When I read "Phantasy Star Online Section ID FAQ" by Miyuu, I quickly realized
that Sonic Team simply used the ASCII values of the individual characters in
the character name to calculate the section ID.  I decided to make my own
section ID calculator program.

When I completed the C++ program, I tested it against many other section ID
calculators on the internet and found that they were often inaccurate when
applied to non-alphanumeric characters in the character names.  I believe this
is from a lack of understanding of how the characters are being deciphered by
PSO.  So you should be wary of the accuracy of these other ID calculators when
you have special characters in your name.

This guide is based on the American version of PSO in the English language mode.

For an explanation on how the section ID is used in the game, read one of the
many fine FAQs at this site.

The source code included in this guide will correctly calculate the section ID
in PSO when given the character name.

These programs are intended to be as efficient as possible.  Therefore, their
final appearance is not unnecessarily elaborate.

C++ version:
It took me only a few minutes to make the C++ program because I knew how PSO
was converting the names into values.  In order to make an executable program
from C++ source code, you have to have a C++ compiler.  Don't ask me where to
get a compiler on the internet.  I got both of mine from books that I bought.
Please don't ask me to send you the executable program.

JavaScript version:
This was the second version I created.  The main problem in developing the
JavaScript version was extracting the ASCII value from a character.  I got the
idea on how to do this from:
<http://www.geol.uni-erlangen.de/geojs/JS_tutorial/5thless.html>
By having the program in a web page and viewable with a web browser, there is a
much better graphical user interface than the C++ version.  To use this
calculator, simply copy and save all the code as an .html file.  Then open it
in a web browser to use it.

PHP version:
If you want to know about PHP, then download the reference manual from
<http://www.php.net>.  This PHP script is compatible on versions of PHP4 and
later.  I'm not sure about compatibility with other previous versions.  To use
this calculator, you must have PHP installed on a webserver.  Then save the
first part as an .html file, and the second as a .php file in the same
directory.

Future version & revisions:
If PSO ver. 2 uses the same algorithm/method described herein, then I'll update
this document with a few lines of text to recognize it.  If I decide to make a
PSO section ID calculator in another computer language, then I will.




===============================================================================
                   _____________________________
                  < 2. Updates, Version History >
                   
===============================================================================

Version 0.1     11 June 2001
Created the C++ calculator program


Version 0.2     12 June 2001
Created this document


Version 0.3     09 July 2001
Modified C++ code from suggestions by Keitaro Urashima (keitaro at mediaone.net)


Version 0.4     29 September 2001
Created the JavaScript calculator


Version 0.5     26 November 2001
Modified the JavaScript calculator


Version 0.6     11 December 2001
Created the PHP calculator


Version 0.7     12 December 2001
Rearranged the sections to put the source code before some other sections.




===============================================================================
                   _______________________________________
                  < 3. What Are The Possible Section IDs? >
                   
===============================================================================

There are 10 possible section IDs in PSO.  I suggest reading one of the
appropriate FAQs to see how they influence the game.

ID Name       (value)

VIRIDIA         (0)
GREENNILL       (1)
SKYLY           (2)
BLUEFULL        (3)
PURPLENUM       (4)
PINKAL          (5)
REDRIA          (6)
ORAN            (7)
YELLOWBOZE      (8)
WHITILL         (9)




===============================================================================
                   ____________________________________________
                  < 4. How Does PSO Calculate Your Section ID? >
                   
===============================================================================

There are 95 available characters for use in your name in PSO.  Your name may
be up to 12 characters in length.

The Dreamcast (like almost every modern computer) uses the ASCII character set
to represent characters in memory.  When a character is stored in a computer's
memory, the computer stores a number that represents that character.

When you enter your character name in PSO, all of the ASCII character values of
that name are added up.  PSO then takes only the "ones" digit of that value and
uses it to assign your section ID.

Example:

If you enter Steve as the character name...
Character name= Steve

To find your section ID, first simply add all the values of the letters.

S=  83
t= 116
e= 101
v= 118
e= 101

total= 519

or you can just add the ones digits of the ASCII values of the characters...

S= 3
t= 6
e= 1
v= 8
e= 1

total= 19

Now take the "ones" digit of this value...
519 (or 19) yields 9.

Since this value is 9, the section ID for Steve is WHITILL.

This method works for any name in PSO.

Many section ID calculators on the internet make errors when non-alphanumeric
characters are included.  This is because they generally don't know how the
characters are being converted to numerical values.




===============================================================================
                   ____________________________________________________
                  < 5. C++ Source Code For A PSO Section ID Calculator >
                   
===============================================================================

//*****************************************************************************
//   C++ PSO Section ID Calculator
//   by Steve Ward
//*****************************************************************************

#include <iostream.h> // uses cout, cin.getline

#define SIZE 13 // the maximum size of the character name in PSO

int main()
{
   int total=0;

   char name[SIZE]={0};

   char *id[]={"VIRIDIA","GREENNILL","SKYLY","BLUEFULL","PURPLENUM","PINKAL","REDRIA","ORAN","YELLOWBOZE","WHITILL"};

   cout<<"Enter your PSO character name: ";
   cin.getline(name,SIZE);

   for(int n=0;n<SIZE;n++)
      total+=name[n]; // the ASCII value of every character is added to the ID

   cout<<"Total value of "<<name<<" is "<<total<<endl;

   cout<<"The new value is "<<(total%=10)<<endl; // the one's digit is taken

   cout<<"Section ID: "<<id[total]<<endl; // the particular ID is displayed

   return 0;
}




===============================================================================
                   _________________________________________
                  < 6. JavaScript PSO Section ID Calculator >
                   
===============================================================================

<!-----------------------------------------------------------------------------
     JavaScript PSO Section ID Calculator
     by Steve Ward
------------------------------------------------------------------------------>

<HTML>

<HEAD>

<TITLE>JavaScript PSO Section ID Calculator</TITLE>

<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">

id=new Array("VIRIDIA","GREENNILL","SKYLY","BLUEFULL","PURPLENUM","PINKAL","REDRIA","ORAN","YELLOWBOZE","WHITILL");

function calc(name)
{
	for(i=0,k=0;i<name.length;i++)
	{
		j=name.charCodeAt(i);

		if(j<32 || j>126)
		{
			alert(name.charAt(i)+" is an invalid character!");
			j=0;
		}

		k+=j;
	}

	document.forms.pso.section.value=id[k%10];

	document.forms.pso.idnumber.value=k;
}

</SCRIPT>

</HEAD>

<BODY>

<FORM name="pso">
<INPUT value="PSO name" maxlength="12" onkeyup="calc(this.value);"><BR>
<INPUT value="Section ID" name="section"><BR>
<INPUT value="total" name="idnumber"><BR>
<INPUT type="reset" value="Reset">
</FORM>

</BODY>

</HTML>




===============================================================================
                   __________________________________
                  < 7. PHP PSO Section ID Calculator >
                   
===============================================================================

<!-----------------------------------------------------------------------------
     PHP PSO Section ID Calculator
     by Steve Ward
------------------------------------------------------------------------------>

<HTML>

<HEAD><TITLE>PHP PSO Section ID Calculator</TITLE></HEAD>

<BODY>

<FORM action="pso-id-calc.php" method="post">
<INPUT maxlength="12" value="PSO name" name="psoname">
<INPUT type="submit" value="Calculate">
<INPUT type="reset" value="Reset">
</FORM>

</BODY>

</HTML>

+-----------------------------------------------------------------------------+
|          Save the following script as: "pso-id-calc.php"                    |
+-----------------------------------------------------------------------------+

<?

$psoname=stripslashes($psoname);

$dispname=htmlentities($psoname);

print("<HTML><HEAD><TITLE>$dispname</TITLE></HEAD><BODY><PRE>");

$sectionids=array("VIRIDIA","GREENNILL","SKYLY","BLUEFULL","PURPLENUM","PINKAL","REDRIA","ORAN","YELLOWBOZE","WHITILL");

for($i=0,$k=0;$i<strlen($psoname);$i++)
{
	$j=ord($psoname{$i}); // Return the ASCII value of a character

	if($j<32 || $j>126)
	{
		printf("<B>%s</B> is an invalid character!<BR>",htmlentities(chr($j)));
		$j=0;
	}

	$k+=$j;
}

$id=$sectionids[$k%10];

print("PSO name: <B>$dispname</B><BR>Section ID: <B>$id</B><BR>total: <B>$k</B></PRE></BODY></HTML>");

?>




===============================================================================
                   _______________________________________
                  < 8. The Complete ASCII Character Table >
                   
===============================================================================

This is a list of the entire ASCII character set used in almost all computers.

Code  Character

  0   NUL (null)
  1   SOH (start of heading)
  2   STX (start of text)
  3   ETX (end of text)
  4   EOT (end of transmission)
  5   ENQ (enquiry)
  6   ACK (acknowledge)
  7   BEL (bell)
  8   BS (backspace)
  9   HT (horizontal tab)
 10   NL,LF (new line, line feed)
 11   VT (vertical tab)
 12   FF,NP (form feed, new page)
 13   CR (carriage return)
 14   SO (shift out)
 15   SI (shift in)
 16   DLE (data link escape)
 17   DC1 (device control 1)
 18   DC2 (device control 2)
 19   DC3 (device control 3)
 20   DC4 (device control 4)
 21   NAK (negative acknowledge)
 22   SYN (synchronous idle)
 23   ETB (end of trans. block)
 24   CAN (cancel)
 25   EM (end of medium)
 26   SUB (substitute)
 27   ESC (escape)
 28   FS (file separator)
 29   GS (group separator)
 30   RS (record separator)
 31   US (unit separator)
 32   SP (space)
 33   !
 34   "
 35   #
 36   $
 37   %
 38   &
 39   '
 40   (
 41   )
 42   *
 43   +
 44   ,
 45   -
 46   .
 47   /
 48   0
 49   1
 50   2
 51   3
 52   4
 53   5
 54   6
 55   7
 56   8
 57   9
 58   :
 59   ;
 60   <
 61   =
 62   >
 63   ?
 64   @
 65   A
 66   B
 67   C
 68   D
 69   E
 70   F
 71   G
 72   H
 73   I
 74   J
 75   K
 76   L
 77   M
 78   N
 79   O
 80   P
 81   Q
 82   R
 83   S
 84   T
 85   U
 86   V
 87   W
 88   X
 89   Y
 90   Z
 91   [
 92   \
 93   ]
 94   ^
 95   _
 96   `
 97   a
 98   b
 99   c
100   d
101   e
102   f
103   g
104   h
105   i
106   j
107   k
108   l
109   m
110   n
111   o
112   p
113   q
114   r
115   s
116   t
117   u
118   v
119   w
120   x
121   y
122   z
123   {
124   |
125   }
126   ~
127   DEL (delete)




===============================================================================
                   _____________________________________
                  < 9. The PSO Software Keyboard Layout >
                   
===============================================================================

This is how the software keyboard is laid out in the game.

Beside each character you will find a number.  This number represents the value
of that character when the section ID is calculated.

Character(value)

A(5) B(6) C(7) D(8) E(9) F(0) G(1) H(2) I(3) J(4) K(5) L(6) M(7) N(8)

O(9) P(0) Q(1) R(2) S(3) T(4) U(5) V(6) W(7) X(8) Y(9) Z(0)

a(7) b(8) c(9) d(0) e(1) f(2) g(3) h(4) i(5) j(6) k(7) l(8) m(9) n(0)

o(1) p(2) q(3) r(4) s(5) t(6) u(7) v(8) w(9) x(0) y(1) z(2)


1(9) 2(0) 3(1) 4(2) 5(3) 6(4) 7(5) 8(6) 9(7) 0(8)


!(3) "(4) #(5) $(6) %(7) &(8) '(9) ((0) )(1) *(2) +(3) ,(4) -(5) .(6) {(3) }(5)

/(7) :(8) ;(9) <(0) >(2) =(1) ?(3) @(4) [(1) ](3) \(2) ^(4) _(5) `(6) |(4) ~(6)


                                                 SPACE(2)




===============================================================================
                   ___________________________________________
                  < 10. Credits, Contact Info, Copyright Info >
                   
===============================================================================

Credits:

This guide was created by me, myself, and I.

Thanks to Sonic Team for making PSO.

I was inspired to write the section ID calculator program after reading the FAQ
by Miyuu.

Thanks to Keitaro Urashima (keitaro at mediaone.net) for contributing some
C++ code modifications that really simplified the execution of the calculator.
It was his idea to:
   Put the IDs into an array
   Use the modulus operator to get the one's digit

Thanks to <http://www.geol.uni-erlangen.de/geojs/JS_tutorial/5thless.html> for
giving me a way to extract the ASCII value from a character in JavaScript.

I used Borland C++ 4.52 and Microsoft Visual C++ 6.0 to compile and test the
C++ program.

I used Internet Explorer 6.0 to test the JavaScript program.

The PHP program works for PHP4.  I'm not sure about previous versions.


Contact info:

Questions, corrections, and comments can be emailed to me at:
supersteve1440@yahoo.com

You can check out other stuff at my homepage:
http://www.geocities.com/supersteve1440/


Copyright Info:

I created this guide and the source code myself, unless otherwise stated.

You may not reproduce, sell, or distrubute this document for profitable or
promotional or commercial purposes without my consent.

You may use this guide for your own personal use.

Please give me credit if you use any part of this document or my source code in
a guide or program of your own, or use it in any way not mentioned here.

You may put this document on your site, web page, etc. as long as you don't try
to take credit for it.

I've allowed several web sites on the internet to present a copy of this
document.  So, if you see this document or source code at a site or in another
publication and they don't give me credit, then they copied me and they should
be dragged into the street and shot (and, by all means, you should hack their
asses).

This document Copyright  2001 Steve Ward.

All source code herein is copyright  2001 Steve Ward.

Phantasy Star Online was created by Sonic Team and is owned by Sega.

All names and trademarks Copyright  2000, 2001 Sega Enterprises, Ltd.



EOF
