Loading ...
Sorry, an error occurred while loading the content.
 

Re: New on this, trying to do something new...

Expand Messages
  • jucabapa79
    Hello Mr. Dagan: Thanks for the sugestion, i know that SVG can not support 3d animation, also my asesor told me about it, I will try to develop the dice as you
    Message 1 of 18 , Jul 2, 2005
      Hello Mr. Dagan:

      Thanks for the sugestion, i know that SVG can not support 3d
      animation, also my asesor told me about it, I will try to develop
      the dice as you suggest, anyway by know the trouble is how to
      control another animation with the result of the dice, I mean, I
      want to move a piece in the board using the result of the random
      number obtained in the dice, If I have time tomorrow i will send my
      first tryings with the code of this animation.

      Thanks again.

      Travsam

      --- In svg-developers@yahoogroups.com, "Samuel Dagan" <dagan@a...>
      wrote:
      > Hi Travsam,
      > Welcome to the club. If you are trying to animate the motion of a
      > dice in 3 dimensions, forget it, this is not for a mid-term
      project.
      > You have to simulate the results of a die as a square, in which
      you
      > can display one of the 6 possibilities, of the results of throwing
      a
      > dice, by scripting visibilty="visible" and "hidden". This is
      simple
      > and so the rest of the monopoly game animation.
      > Cheers, Samy
      >
      > --- In svg-developers@yahoogroups.com, "jucabapa79"
      <jucabapa79@y...>
      > wrote:
      > > Hello, thank you very much for the answer.
      > >
      > > I want to explain the trouble I am doing now.
      > >
      > > First of all I want to develop a die, it means this object will
      > > allow the piece to move, depending of the number the dice throws
      > the
      > > piece will move, in SVG Talking it means that the button of
      throw
      > > the die will control the movement of the piece.
      > >
      > > I wanted to make the animation of the die showing the number but
      i
      > > found it difficult, there are some ways : to show and hide some
      svg
      > > illustrations that are in the same place.
      > >
      > > By now I try an easy way, only a button to make the animation of
      > the
      > > piece on the board, but i still have troubles with it.
      > >
      > > If the code is needed please let me know.
      > >
      > > Greetings and thanks.
      > >
      > > Travsam
      > >
      > > --- In svg-developers@yahoogroups.com, "Andreas Neumann"
      > > <neumann@k...> wrote:
      > > > Hi,
      > > >
      > > > can you isolate the problem and post a small example where the
      > > code
      > > > does not work? Or at least better describe what you want to
      > > achieve
      > > > and where exactly you fail? Otherwise we can't really
      understand
      > > > your problem.
      > > >
      > > > If you have general questions for scripting and DOM, you can
      have
      > > a
      > > > look at the SVG/DOM/Scripting tutorial at
      > > >
      > >
      >
      http://www.carto.net/papers/svg/manipulating_svg_with_dom_ecmascript/
      > >
      > > >
      > > > Andreas
      > > >
      > > > --- In svg-developers@yahoogroups.com, "jucabapa79"
      > > > <jucabapa79@y...> wrote:
      > > > > Hello, I am Travsam, I am new on this matters of SVG and I
      > > wanted
      > > > to
      > > > > try to do something different using SVG Code for my midterm
      > > > project, a
      > > > > simulation of the board game Monopoly.
      > > > >
      > > > > The trouble I want to ask about is about the dices, I tried
      > some
      > > > ways
      > > > > to animate the dices, but even that i now how to select
      random
      > > > numbers
      > > > > using JavaScript the rest of the code is not working
      properly.
      > > > >
      > > > > What recommendation would you give me?
      > > > >
      > > > > I will be happy to read your replies.
      > > > >
      > > > > Greetings
    • jucabapa79
      Well, for begin this, I could first refer for the code i made for show the dice results. This is not running properly when i test it in the computer, it don t
      Message 2 of 18 , Jul 3, 2005
        Well, for begin this, I could first refer for the code i made for
        show the dice results. This is not running properly when i test it
        in the computer, it don't shows anything. What's wrong?

        Greetings

        Travsam

        -------------------------This is the code--------------------------
        <?xml version="1.0"?>


        <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
        1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
        <svg width="500px" height="500px" viewBox="0 0 500 500">
        <script language="text/ecmasscript">
        <![CDATA[
        /** Configures the dice according to a six number's random select.
        It should change the visibility status of one or two of four
        different SVG objects forming dice forms.
        The default number is 1, the visibility will change depending
        of the number, cases of number 3 and 5 will be
        made over combinations of forms two and four combinations with
        the one combination.
        */
        function throwdice(){
        //create a random integer between 0 and 5
        var randomDice=Math.round(Math.random()*5)
        dice = randomDice
        switch (dice)
        {

        case 1:
        d1.visibility("hidden")
        d2.visibility("visible")
        d4.visibility("hidden")
        d6.visibility("hidden")
        break
        case 2:
        d1.visibility("visible")
        d2.visibility("visible")
        d4.visibility("hidden")
        d6.visibility("hidden")
        break
        case 3:
        d1.visibility("hidden")
        d2.visibility("hidden")
        d4.visibility("visible")
        d6.visibility("hidden")
        break
        case 4:
        d1.visibility("visible")
        d2.visibility("hidden")
        d4.visibility("visible")
        d6.visibility("hidden")
        break
        case 5:
        d1.visibility("hidden")
        d2.visibility("hidden")
        d4.visibility("hidden")
        d6.visibility("visible")
        break
        default:
        d1.visibility("visible")
        d2.visibility("hidden")
        d4.visibility("hidden")
        d6.visibility("hidden")
        break
        }
        }
        ]]>

        </script>
        <!-- creating the dice pictures, as I refered, the forms are based
        in dice forms, there are not
        three and five forms because it was based on combinations of one and
        other combination (It means, five
        will be made combining four and one combination and three will be
        made combining two and one). Also
        there is the button that can throw the dice-->
        <defs>
        <g onclick="throwDice();">
        <rect x="70" y="10" width="60" height="20" rx="4" ry="4"
        style="fill: #ddd;"/>
        <text x="100" y="25" style="text-anchor:
        middle;">Throw</text>
        </g>
        <g id="d6" visibility="hidden">
        <rect x="50" y="50" height="100" width="100" style="stroke:
        black; fill: none;"/>
        <circle cx="125" cy="125" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="75" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="125" cy="75" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="125" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="100" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="125" cy="100" r="10" style="stroke: none; fill:
        blue;"/>
        </g>
        <g id="d1" visibility="visible">
        <rect x="50" y="50" height="100" width="100" style="stroke:
        black; fill: none;"/>
        <circle cx="100" cy="100" r="10" style="stroke: none; fill:
        blue;"/>
        </g>
        <g id="d2" visibility="hidden">
        <rect x="50" y="50" height="100" width="100" style="stroke:
        black; fill: none;"/>
        <circle cx="125" cy="125" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="75" r="10" style="stroke: none; fill:
        blue;"/>
        </g>
        <g id="d4" visibility="hidden">
        <rect x="50" y="50" height="100" width="100" style="stroke:
        black; fill: none;"/>
        <circle cx="125" cy="125" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="75" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="125" cy="75" r="10" style="stroke: none; fill:
        blue;"/>
        <circle cx="75" cy="125" r="10" style="stroke: none; fill:
        blue;"/>
        </g>
        </defs>
        </svg>
      • Samuel Dagan
        Hi Travsam, As an answer to your question, many things are wrong in your script: where are the end marks of the command lines(;) ? What is:
        Message 3 of 18 , Jul 4, 2005
          Hi Travsam,
          As an answer to your question, many things are wrong in your
          script: where are the end marks of the command lines(;) ?
          What is: d1.visibility("hidden") ? This is not an ecmascript command!
          I undeststand that this is your mid-term project, so you have to
          pick up a book from the library of your college, and first learn how
          to code ecma-script for SVG.
          In the SVG coding, you have everything inside <defs>....</defs>,
          where are the <use>....</use> ? You have also to learn SVG! You can
          use the same book for both.
          Good luck with YOUR project, Samy

          --- In svg-developers@yahoogroups.com, "jucabapa79" <jucabapa79@y...>
          wrote:
          > Well, for begin this, I could first refer for the code i made for
          > show the dice results. This is not running properly when i test it
          > in the computer, it don't shows anything. What's wrong?
          >
          > Greetings
          >
          > Travsam
          >
          > -------------------------This is the code--------------------------
          > <?xml version="1.0"?>
          >
          >
          > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
          > 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
          > <svg width="500px" height="500px" viewBox="0 0 500 500">
          > <script language="text/ecmasscript">
          > <![CDATA[
          > /** Configures the dice according to a six number's random select.
          > It should change the visibility status of one or two of four
          > different SVG objects forming dice forms.
          > The default number is 1, the visibility will change depending
          > of the number, cases of number 3 and 5 will be
          > made over combinations of forms two and four combinations
          with
          > the one combination.
          > */
          > function throwdice(){
          > //create a random integer between 0 and 5
          > var randomDice=Math.round(Math.random()*5)
          > dice = randomDice
          > switch (dice)
          > {
          >
          > case 1:
          > d1.visibility("hidden")
          > d2.visibility("visible")
          > d4.visibility("hidden")
          > d6.visibility("hidden")
          > break
          > case 2:
          > d1.visibility("visible")
          > d2.visibility("visible")
          > d4.visibility("hidden")
          > d6.visibility("hidden")
          > break
          > case 3:
          > d1.visibility("hidden")
          > d2.visibility("hidden")
          > d4.visibility("visible")
          > d6.visibility("hidden")
          > break
          > case 4:
          > d1.visibility("visible")
          > d2.visibility("hidden")
          > d4.visibility("visible")
          > d6.visibility("hidden")
          > break
          > case 5:
          > d1.visibility("hidden")
          > d2.visibility("hidden")
          > d4.visibility("hidden")
          > d6.visibility("visible")
          > break
          > default:
          > d1.visibility("visible")
          > d2.visibility("hidden")
          > d4.visibility("hidden")
          > d6.visibility("hidden")
          > break
          > }
          > }
          > ]]>
          >
          > </script>
          > <!-- creating the dice pictures, as I refered, the forms are based
          > in dice forms, there are not
          > three and five forms because it was based on combinations of one
          and
          > other combination (It means, five
          > will be made combining four and one combination and three will be
          > made combining two and one). Also
          > there is the button that can throw the dice-->
          > <defs>
          > <g onclick="throwDice();">
          > <rect x="70" y="10" width="60" height="20" rx="4" ry="4"
          > style="fill: #ddd;"/>
          > <text x="100" y="25" style="text-anchor:
          > middle;">Throw</text>
          > </g>
          > <g id="d6" visibility="hidden">
          > <rect x="50" y="50" height="100" width="100" style="stroke:
          > black; fill: none;"/>
          > <circle cx="125" cy="125" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="75" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="125" cy="75" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="125" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="100" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="125" cy="100" r="10" style="stroke: none; fill:
          > blue;"/>
          > </g>
          > <g id="d1" visibility="visible">
          > <rect x="50" y="50" height="100" width="100" style="stroke:
          > black; fill: none;"/>
          > <circle cx="100" cy="100" r="10" style="stroke: none; fill:
          > blue;"/>
          > </g>
          > <g id="d2" visibility="hidden">
          > <rect x="50" y="50" height="100" width="100" style="stroke:
          > black; fill: none;"/>
          > <circle cx="125" cy="125" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="75" r="10" style="stroke: none; fill:
          > blue;"/>
          > </g>
          > <g id="d4" visibility="hidden">
          > <rect x="50" y="50" height="100" width="100" style="stroke:
          > black; fill: none;"/>
          > <circle cx="125" cy="125" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="75" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="125" cy="75" r="10" style="stroke: none; fill:
          > blue;"/>
          > <circle cx="75" cy="125" r="10" style="stroke: none; fill:
          > blue;"/>
          > </g>
          > </defs>
          > </svg>
        • jucabapa79
          Oh yes, I am sorry, thank you for aclaring this, in fact I found by myself some of the mistakes, but even that i corrected the syntax mistakes, I can not find
          Message 4 of 18 , Jul 4, 2005
            Oh yes, I am sorry, thank you for aclaring this, in fact I found by
            myself some of the mistakes, but even that i corrected the syntax
            mistakes, I can not find the correct SVG code for make the correct
            animation..., this is the new code, and even that i can see some of
            the code i want, it still don't runs properly clicking the throw
            button.

            I know that is my project, I know that I am only an student and I am
            still learning this, that is why I am asking for advices.

            Thank you very much.

            Travsam.

            <?xml version="1.0"?>


            <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
            1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
            <svg width="1000px" height="1000px" viewBox="0 0 1000 1000">
            <script language="text/ecmasscript">
            <![CDATA[
            /** Configures the dice according to a six number's random select.
            It should change the visibility status of one SVG object
            forming dice forms.
            The default number is 1, the visibility will change depending
            of the number.
            */

            function throwDice(){

            var randomDice=Math.round(Math.random()*5);
            dice = randomDice;

            switch ( dice )
            {

            case 1:
            var d2 = svgDocument.getElementbyId("d2");
            d2.setAttribute( "visibility", visStatus );
            break;
            case 2:
            var d3 = svgDocument.getElementbyId("d3");
            d3.setAttribute( "visibility", visStatus );
            break;
            case 3:
            var d4 = svgDocument.getElementbyId("d4");
            d4.setAttribute( "visibility", visStatus );
            break;
            case 4:
            var d5 = svgDocument.getElementbyId("d5");
            d5.setAttribute( "visibility", visStatus );
            break;
            case 5:
            var d6 = svgDocument.getElementbyId("d6");
            d6.setAttribute( "visibility", visStatus );
            break;
            default:
            var d1 = svgDocument.getElementbyId("d1");
            d1.setAttribute( "visibility", visStatus );

            }

            }

            ]]>

            </script>
            <!-- creating the dice pictures that had to match with the value of
            the random number-->

            <g id="d1" visibility="visible">
            <circle cx="100" cy="100" r="10" style="fill: blue;"/>
            </g>
            <g id="d2" visibility="hidden">
            <circle cx="125" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="75" r="10" style="fill: blue;"/>
            </g>
            <g id="d3" visibility="hidden">
            <circle cx="125" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="75" r="10" style="fill: blue;"/>
            <circle cx="100" cy="100" r="10" style="fill: blue;"/>
            </g>
            <g id="d4" visibility="hidden">
            <circle cx="125" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="75" r="10" style="fill: blue;"/>
            <circle cx="125" cy="75" r="10" style="fill: blue;"/>
            <circle cx="75" cy="125" r="10" style="fill: blue;"/>
            </g>
            <g id="d5" visibility="hidden">
            <circle cx="125" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="75" r="10" style="fill: blue;"/>
            <circle cx="125" cy="75" r="10" style="fill: blue;"/>
            <circle cx="75" cy="125" r="10" style="fill: blue;"/>
            <circle cx="100" cy="100" r="10" style="fill: blue;"/>
            </g>
            <g id="d6" visibility="hidden">
            <circle cx="125" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="75" r="10" style="fill: blue;"/>
            <circle cx="125" cy="75" r="10" style="fill: blue;"/>
            <circle cx="75" cy="125" r="10" style="fill: blue;"/>
            <circle cx="75" cy="100" r="10" style="fill: blue;"/>
            <circle cx="125" cy="100" r="10" style="fill: blue;"/>
            </g>

            <!--creating the button Throw-->
            <g onclick="throwDice();">
            <rect x="70" y="10" width="60" height="20" rx="4" ry="4"
            style="fill: #ddd;"/>
            <text x="100" y="25" style="text-anchor:
            middle;">Throw</text>
            </g>
            <!--creating the square that involves the dice-->
            <rect x="50" y="50" height="100" width="100" style="fill:
            none; stroke: black;"/>
            </svg>
          • Holger Will
            ... Hi Travsam there where a few flaws in your code. let me just mention this: please allways declare the namespace(xmlns)!! like here:
            Message 5 of 18 , Jul 5, 2005
              jucabapa79 schrieb:

              > Oh yes, I am sorry, thank you for aclaring this, in fact I found by
              > myself some of the mistakes, but even that i corrected the syntax
              > mistakes, I can not find the correct SVG code for make the correct
              > animation..., this is the new code, and even that i can see some of
              > the code i want, it still don't runs properly clicking the throw
              > button.
              >
              > I know that is my project, I know that I am only an student and I am
              > still learning this, that is why I am asking for advices.
              >
              > Thank you very much.
              >
              > Travsam.

              Hi Travsam
              there where a few flaws in your code. let me just mention this:
              please allways declare the namespace(xmlns)!! like here:
              <svg width="1000px" height="1000px" viewBox="0 0 1000 1000"
              xmlns="http://www.w3.org/2000/svg">


              you can use this script, try to understand what im doing here:

              <script>
              <![CDATA[
              function throwDice(){

              var randomDice=Math.round(Math.random()*5) + 1;
              dice = randomDice;

              for(var i = 1;i<7;i++){
              var d = document.getElementById("d"+ i);
              if(i==dice){
              d.setAttribute( "visibility", "visible" );
              }else{
              d.setAttribute( "visibility", "hidden" );
              }

              }


              }

              ]]>

              </script>

              hth
              Holger
            • jucabapa79
              Hello Mr. Holger I thank you very much for helping me, I forgot to put the reference of the svg page and i will put it in my next codes. Also I am reviewing
              Message 6 of 18 , Jul 5, 2005
                Hello Mr. Holger

                I thank you very much for helping me, I forgot to put the reference
                of the svg page and i will put it in my next codes.

                Also I am reviewing the JavaScript code, I will learn of it and I
                will try to apply this code to other function I want to assign to
                the DiceValue code.

                Thanks again.

                Travsam



                > <script>
                > <![CDATA[
                > function throwDice(){
                >
                > var randomDice=Math.round(Math.random()*5) + 1;
                > dice = randomDice;
                >
                > for(var i = 1;i<7;i++){
                > var d = document.getElementById("d"+ i);
                > if(i==dice){
                > d.setAttribute( "visibility", "visible" );
                > }else{
                > d.setAttribute( "visibility", "hidden" );
                > }
                >
                > }
                >
                >
                > }
                >
                > ]]>
                >
                > </script>
                >
                > hth
                > Holger
              • jucabapa79
                Me again... As I told in some of the messages my dice will have two functions, the first one it was solved, but I still have troubles with the second one. The
                Message 7 of 18 , Jul 5, 2005
                  Me again...

                  As I told in some of the messages my dice will have two functions,
                  the first one it was solved, but I still have troubles with the
                  second one.

                  The objective is to move a piece in the sides of a square board of
                  700*700 and I tried using the script down below.

                  But any moment I try to load the SVG the javascript reader gives an
                  exception because is expecting an object, but all SVG is loaded
                  properly, anyway anytime that I click on the "Throw" button gets the
                  same mistake.

                  Any suggestion?

                  Travsam

                  <script type="text/ecmasscript">
                  <![CDATA[
                  /** The dice should move a piece in a board, the piece is
                  in the right down corner, the piece has first to
                  move to the left, when it gets the corner will move up, and
                  so on, moving in the trayectory of the clock, the
                  movement will be controled by a random number between 1 and
                  6.
                  */

                  // svg variables
                  var svgdoc;
                  var svgroot;

                  // game area variables
                  var xMax = 700;
                  var yMax = 700;
                  var xMin = 100;
                  var yMin = 100;

                  // game variables
                  var piece;
                  var pieceX = 700;
                  var pieceY = 700;

                  function init (evt) {

                  svgdoc = evt.getTarget().getOwnerDocument();
                  svgroot = svgdoc.documentElement;
                  piece = svgdoc.getElementbyId("piece");

                  }

                  // function throwDice, it will choose a number between 1 and
                  6 and set it as value "dice"

                  function throwDice(){

                  var randomDice=Math.round(Math.random()*5) + 1;
                  dice = randomDice;


                  }
                  // function movePiece, first it will move the piece to the
                  left, then it
                  have to check when the piece arribes to the left corner then
                  it moves up and so
                  on, also it will use the counter "dice" that comes from the
                  throwDice function.

                  function movePiece()
                  {

                  Do
                  {
                  pieceX = pieceX - 100;
                  if pieceX = xMin and pieceY = yMax
                  {
                  pieceY = pieceY - 100;
                  }
                  else if pieceX = xMin AND pieceY = yMin
                  {
                  pieceX = pieceX + 100;
                  }
                  else if pieceX = xMax AND pieceY = yMin
                  {
                  pieceY = pieceY + 100;
                  }
                  Dice = Dice-1;
                  piece.setAttribute("cx",pieceX);
                  piece.setAttribute("cy",pieceY);
                  }
                  While Dice > 0;

                  }


                  // ]]>

                  </script>
                • Holger Will
                  ... hi ive written two small examples, the first is a simple game framework. showing a simple gameloop. http://www.treebuilder.de/svg/monopoly01.svg the second
                  Message 8 of 18 , Jul 7, 2005
                    jucabapa79 schrieb:

                    > Me again...
                    >
                    > As I told in some of the messages my dice will have two functions,
                    > the first one it was solved, but I still have troubles with the
                    > second one.
                    >
                    > The objective is to move a piece in the sides of a square board of
                    > 700*700 and I tried using the script down below.
                    >
                    > But any moment I try to load the SVG the javascript reader gives an
                    > exception because is expecting an object, but all SVG is loaded
                    > properly, anyway anytime that I click on the "Throw" button gets the
                    > same mistake.
                    >
                    > Any suggestion?

                    hi
                    ive written two small examples,
                    the first is a simple game framework. showing a simple gameloop.
                    http://www.treebuilder.de/svg/monopoly01.svg
                    the second is a basic monopoly framework,
                    http://www.treebuilder.de/svg/monopoly02.svg
                    study both examples, if you have any questions concerning this code,
                    just ask.
                    cheers
                    Holger

                    >
                    > Travsam
                    >
                    > <script type="text/ecmasscript">
                    > <![CDATA[
                    > /** The dice should move a piece in a board, the piece is
                    > in the right down corner, the piece has first to
                    > move to the left, when it gets the corner will move up, and
                    > so on, moving in the trayectory of the clock, the
                    > movement will be controled by a random number between 1 and
                    > 6.
                    > */
                    >
                    > // svg variables
                    > var svgdoc;
                    > var svgroot;
                    >
                    > // game area variables
                    > var xMax = 700;
                    > var yMax = 700;
                    > var xMin = 100;
                    > var yMin = 100;
                    >
                    > // game variables
                    > var piece;
                    > var pieceX = 700;
                    > var pieceY = 700;
                    >
                    > function init (evt) {
                    >
                    > svgdoc = evt.getTarget().getOwnerDocument();
                    > svgroot = svgdoc.documentElement;
                    > piece = svgdoc.getElementbyId("piece");
                    >
                    > }
                    >
                    > // function throwDice, it will choose a number between 1 and
                    > 6 and set it as value "dice"
                    >
                    > function throwDice(){
                    >
                    > var randomDice=Math.round(Math.random()*5) + 1;
                    > dice = randomDice;
                    >
                    >
                    > }
                    > // function movePiece, first it will move the piece to the
                    > left, then it
                    > have to check when the piece arribes to the left corner then
                    > it moves up and so
                    > on, also it will use the counter "dice" that comes from the
                    > throwDice function.
                    >
                    > function movePiece()
                    > {
                    >
                    > Do
                    > {
                    > pieceX = pieceX - 100;
                    > if pieceX = xMin and pieceY = yMax
                    > {
                    > pieceY = pieceY - 100;
                    > }
                    > else if pieceX = xMin AND pieceY = yMin
                    > {
                    > pieceX = pieceX + 100;
                    > }
                    > else if pieceX = xMax AND pieceY = yMin
                    > {
                    > pieceY = pieceY + 100;
                    > }
                    > Dice = Dice-1;
                    > piece.setAttribute("cx",pieceX);
                    > piece.setAttribute("cy",pieceY);
                    > }
                    > While Dice > 0;
                    >
                    > }
                    >
                    >
                    > // ]]>
                    >
                    > </script>
                    >
                  • jucabapa79
                    Mr. Holger, I will check the code made by you and study all the properties, so I can adapt it to my game board, and also to learn more about scripting because
                    Message 9 of 18 , Jul 7, 2005
                      Mr. Holger, I will check the code made by you and study all the
                      properties, so I can adapt it to my game board, and also to learn
                      more about scripting because for me it this the most difficult thing
                      in SVG.

                      I will do my best.

                      Travsam

                      --- In svg-developers@yahoogroups.com, Holger Will <holger@t...>
                      wrote:
                      > jucabapa79 schrieb:
                      >
                      > > Me again...
                      > >
                      > > As I told in some of the messages my dice will have two
                      functions,
                      > > the first one it was solved, but I still have troubles with the
                      > > second one.
                      > >
                      > > The objective is to move a piece in the sides of a square board
                      of
                      > > 700*700 and I tried using the script down below.
                      > >
                      > > But any moment I try to load the SVG the javascript reader gives
                      an
                      > > exception because is expecting an object, but all SVG is loaded
                      > > properly, anyway anytime that I click on the "Throw" button gets
                      the
                      > > same mistake.
                      > >
                      > > Any suggestion?
                      >
                      > hi
                      > ive written two small examples,
                      > the first is a simple game framework. showing a simple gameloop.
                      > http://www.treebuilder.de/svg/monopoly01.svg
                      > the second is a basic monopoly framework,
                      > http://www.treebuilder.de/svg/monopoly02.svg
                      > study both examples, if you have any questions concerning this
                      code,
                      > just ask.
                      > cheers
                      > Holger
                      >
                      > >
                      > > Travsam
                      > >
                      > > <script type="text/ecmasscript">
                      > > <![CDATA[
                      > > /** The dice should move a piece in a board, the piece is
                      > > in the right down corner, the piece has first to
                      > > move to the left, when it gets the corner will move up, and
                      > > so on, moving in the trayectory of the clock, the
                      > > movement will be controled by a random number between 1 and
                      > > 6.
                      > > */
                      > >
                      > > // svg variables
                      > > var svgdoc;
                      > > var svgroot;
                      > >
                      > > // game area variables
                      > > var xMax = 700;
                      > > var yMax = 700;
                      > > var xMin = 100;
                      > > var yMin = 100;
                      > >
                      > > // game variables
                      > > var piece;
                      > > var pieceX = 700;
                      > > var pieceY = 700;
                      > >
                      > > function init (evt) {
                      > >
                      > > svgdoc = evt.getTarget().getOwnerDocument();
                      > > svgroot = svgdoc.documentElement;
                      > > piece = svgdoc.getElementbyId("piece");
                      > >
                      > > }
                      > >
                      > > // function throwDice, it will choose a number between 1
                      and
                      > > 6 and set it as value "dice"
                      > >
                      > > function throwDice(){
                      > >
                      > > var randomDice=Math.round(Math.random()*5) + 1;
                      > > dice = randomDice;
                      > >
                      > >
                      > > }
                      > > // function movePiece, first it will move the piece to the
                      > > left, then it
                      > > have to check when the piece arribes to the left corner
                      then
                      > > it moves up and so
                      > > on, also it will use the counter "dice" that comes from the
                      > > throwDice function.
                      > >
                      > > function movePiece()
                      > > {
                      > >
                      > > Do
                      > > {
                      > > pieceX = pieceX - 100;
                      > > if pieceX = xMin and pieceY = yMax
                      > > {
                      > > pieceY = pieceY - 100;
                      > > }
                      > > else if pieceX = xMin AND pieceY = yMin
                      > > {
                      > > pieceX = pieceX + 100;
                      > > }
                      > > else if pieceX = xMax AND pieceY = yMin
                      > > {
                      > > pieceY = pieceY + 100;
                      > > }
                      > > Dice = Dice-1;
                      > > piece.setAttribute("cx",pieceX);
                      > > piece.setAttribute("cy",pieceY);
                      > > }
                      > > While Dice > 0;
                      > >
                      > > }
                      > >
                      > >
                      > > // ]]>
                      > >
                      > > </script>
                      > >
                    • jucabapa79
                      Good afternoon. I review the code made by Mr. Holger and this is working properly in a 3 X 3 board, but I have troubles to make it run properly in a 6 X 6
                      Message 10 of 18 , Jul 7, 2005
                        Good afternoon.

                        I review the code made by Mr. Holger and this is working properly in
                        a 3 X 3 board, but I have troubles to make it run properly in a 6 X
                        6 board what I mean?

                        First I made that my game pieces run in the down right corner, but
                        when the pieces began to run using the throw button, they are
                        running first one space to the left and then one space down, and
                        they never go straight in one direction and also they go out of the
                        board.

                        Would someone explain me what is going on? What do you suggest to
                        correct this bug and made it run properly?

                        Greetings.

                        Travsam

                        --- In svg-developers@yahoogroups.com, "jucabapa79"
                        <jucabapa79@y...> wrote:
                        > Mr. Holger, I will check the code made by you and study all the
                        > properties, so I can adapt it to my game board, and also to learn
                        > more about scripting because for me it this the most difficult
                        thing
                        > in SVG.
                        >
                        > I will do my best.
                        >
                        > Travsam
                        >
                        > --- In svg-developers@yahoogroups.com, Holger Will <holger@t...>
                        > wrote:
                        > > jucabapa79 schrieb:
                        > >
                        > > > Me again...
                        > > >
                        > > > As I told in some of the messages my dice will have two
                        > functions,
                        > > > the first one it was solved, but I still have troubles with the
                        > > > second one.
                        > > >
                        > > > The objective is to move a piece in the sides of a square
                        board
                        > of
                        > > > 700*700 and I tried using the script down below.
                        > > >
                        > > > But any moment I try to load the SVG the javascript reader
                        gives
                        > an
                        > > > exception because is expecting an object, but all SVG is loaded
                        > > > properly, anyway anytime that I click on the "Throw" button
                        gets
                        > the
                        > > > same mistake.
                        > > >
                        > > > Any suggestion?
                        > >
                        > > hi
                        > > ive written two small examples,
                        > > the first is a simple game framework. showing a simple gameloop.
                        > > http://www.treebuilder.de/svg/monopoly01.svg
                        > > the second is a basic monopoly framework,
                        > > http://www.treebuilder.de/svg/monopoly02.svg
                        > > study both examples, if you have any questions concerning this
                        > code,
                        > > just ask.
                        > > cheers
                        > > Holger
                        > >
                        > > >
                        > > > Travsam
                        > > >
                        > > > <script type="text/ecmasscript">
                        > > > <![CDATA[
                        > > > /** The dice should move a piece in a board, the piece
                        is
                        > > > in the right down corner, the piece has first to
                        > > > move to the left, when it gets the corner will move up,
                        and
                        > > > so on, moving in the trayectory of the clock, the
                        > > > movement will be controled by a random number between 1
                        and
                        > > > 6.
                        > > > */
                        > > >
                        > > > // svg variables
                        > > > var svgdoc;
                        > > > var svgroot;
                        > > >
                        > > > // game area variables
                        > > > var xMax = 700;
                        > > > var yMax = 700;
                        > > > var xMin = 100;
                        > > > var yMin = 100;
                        > > >
                        > > > // game variables
                        > > > var piece;
                        > > > var pieceX = 700;
                        > > > var pieceY = 700;
                        > > >
                        > > > function init (evt) {
                        > > >
                        > > > svgdoc = evt.getTarget().getOwnerDocument();
                        > > > svgroot = svgdoc.documentElement;
                        > > > piece = svgdoc.getElementbyId("piece");
                        > > >
                        > > > }
                        > > >
                        > > > // function throwDice, it will choose a number between 1
                        > and
                        > > > 6 and set it as value "dice"
                        > > >
                        > > > function throwDice(){
                        > > >
                        > > > var randomDice=Math.round(Math.random()*5) + 1;
                        > > > dice = randomDice;
                        > > >
                        > > >
                        > > > }
                        > > > // function movePiece, first it will move the piece to
                        the
                        > > > left, then it
                        > > > have to check when the piece arribes to the left corner
                        > then
                        > > > it moves up and so
                        > > > on, also it will use the counter "dice" that comes from
                        the
                        > > > throwDice function.
                        > > >
                        > > > function movePiece()
                        > > > {
                        > > >
                        > > > Do
                        > > > {
                        > > > pieceX = pieceX - 100;
                        > > > if pieceX = xMin and pieceY = yMax
                        > > > {
                        > > > pieceY = pieceY - 100;
                        > > > }
                        > > > else if pieceX = xMin AND pieceY = yMin
                        > > > {
                        > > > pieceX = pieceX + 100;
                        > > > }
                        > > > else if pieceX = xMax AND pieceY = yMin
                        > > > {
                        > > > pieceY = pieceY + 100;
                        > > > }
                        > > > Dice = Dice-1;
                        > > > piece.setAttribute("cx",pieceX);
                        > > > piece.setAttribute("cy",pieceY);
                        > > > }
                        > > > While Dice > 0;
                        > > >
                        > > > }
                        > > >
                        > > >
                        > > > // ]]>
                        > > >
                        > > > </script>
                        > > >
                      • jucabapa79
                        I repaired the board table and the pieces go straight to the left as I plan but it still don t turn and go out of the game board... I will follow searching
                        Message 11 of 18 , Jul 7, 2005
                          I repaired the board table and the pieces go straight to the left as
                          I plan but it still don't turn and go out of the game board...

                          I will follow searching what is wrong...

                          Greetings.

                          --- In svg-developers@yahoogroups.com, "jucabapa79"
                          <jucabapa79@y...> wrote:
                          > Good afternoon.
                          >
                          > I review the code made by Mr. Holger and this is working properly
                          in
                          > a 3 X 3 board, but I have troubles to make it run properly in a 6
                          X
                          > 6 board what I mean?
                          >
                          > First I made that my game pieces run in the down right corner, but
                          > when the pieces began to run using the throw button, they are
                          > running first one space to the left and then one space down, and
                          > they never go straight in one direction and also they go out of
                          the
                          > board.
                          >
                          > Would someone explain me what is going on? What do you suggest to
                          > correct this bug and made it run properly?
                          >
                          > Greetings.
                          >
                          > Travsam
                          >
                          > --- In svg-developers@yahoogroups.com, "jucabapa79"
                          > <jucabapa79@y...> wrote:
                          > > Mr. Holger, I will check the code made by you and study all the
                          > > properties, so I can adapt it to my game board, and also to
                          learn
                          > > more about scripting because for me it this the most difficult
                          > thing
                          > > in SVG.
                          > >
                          > > I will do my best.
                          > >
                          > > Travsam
                          > >
                          > > --- In svg-developers@yahoogroups.com, Holger Will <holger@t...>
                          > > wrote:
                          > > > jucabapa79 schrieb:
                          > > >
                          > > > > Me again...
                          > > > >
                          > > > > As I told in some of the messages my dice will have two
                          > > functions,
                          > > > > the first one it was solved, but I still have troubles with
                          the
                          > > > > second one.
                          > > > >
                          > > > > The objective is to move a piece in the sides of a square
                          > board
                          > > of
                          > > > > 700*700 and I tried using the script down below.
                          > > > >
                          > > > > But any moment I try to load the SVG the javascript reader
                          > gives
                          > > an
                          > > > > exception because is expecting an object, but all SVG is
                          loaded
                          > > > > properly, anyway anytime that I click on the "Throw" button
                          > gets
                          > > the
                          > > > > same mistake.
                          > > > >
                          > > > > Any suggestion?
                          > > >
                          > > > hi
                          > > > ive written two small examples,
                          > > > the first is a simple game framework. showing a simple
                          gameloop.
                          > > > http://www.treebuilder.de/svg/monopoly01.svg
                          > > > the second is a basic monopoly framework,
                          > > > http://www.treebuilder.de/svg/monopoly02.svg
                          > > > study both examples, if you have any questions concerning this
                          > > code,
                          > > > just ask.
                          > > > cheers
                          > > > Holger
                          > > >
                          > > > >
                          > > > > Travsam
                          > > > >
                          > > > > <script type="text/ecmasscript">
                          > > > > <![CDATA[
                          > > > > /** The dice should move a piece in a board, the
                          piece
                          > is
                          > > > > in the right down corner, the piece has first to
                          > > > > move to the left, when it gets the corner will move
                          up,
                          > and
                          > > > > so on, moving in the trayectory of the clock, the
                          > > > > movement will be controled by a random number between
                          1
                          > and
                          > > > > 6.
                          > > > > */
                          > > > >
                          > > > > // svg variables
                          > > > > var svgdoc;
                          > > > > var svgroot;
                          > > > >
                          > > > > // game area variables
                          > > > > var xMax = 700;
                          > > > > var yMax = 700;
                          > > > > var xMin = 100;
                          > > > > var yMin = 100;
                          > > > >
                          > > > > // game variables
                          > > > > var piece;
                          > > > > var pieceX = 700;
                          > > > > var pieceY = 700;
                          > > > >
                          > > > > function init (evt) {
                          > > > >
                          > > > > svgdoc = evt.getTarget().getOwnerDocument();
                          > > > > svgroot = svgdoc.documentElement;
                          > > > > piece = svgdoc.getElementbyId("piece");
                          > > > >
                          > > > > }
                          > > > >
                          > > > > // function throwDice, it will choose a number between
                          1
                          > > and
                          > > > > 6 and set it as value "dice"
                          > > > >
                          > > > > function throwDice(){
                          > > > >
                          > > > > var randomDice=Math.round(Math.random()*5) + 1;
                          > > > > dice = randomDice;
                          > > > >
                          > > > >
                          > > > > }
                          > > > > // function movePiece, first it will move the piece to
                          > the
                          > > > > left, then it
                          > > > > have to check when the piece arribes to the left
                          corner
                          > > then
                          > > > > it moves up and so
                          > > > > on, also it will use the counter "dice" that comes
                          from
                          > the
                          > > > > throwDice function.
                          > > > >
                          > > > > function movePiece()
                          > > > > {
                          > > > >
                          > > > > Do
                          > > > > {
                          > > > > pieceX = pieceX - 100;
                          > > > > if pieceX = xMin and pieceY = yMax
                          > > > > {
                          > > > > pieceY = pieceY - 100;
                          > > > > }
                          > > > > else if pieceX = xMin AND pieceY = yMin
                          > > > > {
                          > > > > pieceX = pieceX + 100;
                          > > > > }
                          > > > > else if pieceX = xMax AND pieceY = yMin
                          > > > > {
                          > > > > pieceY = pieceY + 100;
                          > > > > }
                          > > > > Dice = Dice-1;
                          > > > > piece.setAttribute("cx",pieceX);
                          > > > > piece.setAttribute("cy",pieceY);
                          > > > > }
                          > > > > While Dice > 0;
                          > > > >
                          > > > > }
                          > > > >
                          > > > >
                          > > > > // ]]>
                          > > > >
                          > > > > </script>
                          > > > >
                        • Holger Will
                          ... i can only comment on those issues , if you tell me what changes you have done to the script. ... good, good ! play around with the code a bit, write
                          Message 12 of 18 , Jul 8, 2005
                            jucabapa79 schrieb:

                            > I repaired the board table and the pieces go straight to the left as
                            > I plan but it still don't turn and go out of the game board...

                            i can only comment on those issues , if you tell me what changes you
                            have done to the script.

                            >
                            > I will follow searching what is wrong...

                            good, good ! play around with the code a bit, write smaller testcases,
                            dont go for the whole game in one shot.
                            let me know when you ve made some progress.

                            cheers
                            Holger
                          • jucabapa79
                            Well, I tried to do all the possible things to fix the trouble with the trayectory of the board, first I configure the code sent by Mr. Holger to use it in a 7
                            Message 13 of 18 , Jul 21, 2005
                              Well, I tried to do all the possible things to fix the trouble with
                              the trayectory of the board, first I configure the code sent by Mr.
                              Holger to use it in a 7 X 7 board, then to check the differences
                              between the program of Mr. Holger and adecuate them to my program
                              and check the typos if there are.

                              Anyway the pieces are still moving in a wrong way, even that I
                              configure the board in different ways the pieces still go straight
                              (what I mean with configure the board?, well, it means that I first
                              put the initial position in the down right square (the bigger X and
                              Y position on a graphic) of the board and then I put it on the up
                              left square (the 0 position of X and Y on the board).

                              But the trouble stays there, it looks like these code is getting me
                              some troubles.

                              if(this.dx==0 && this.dy==0 && this.move!=0) {
                              this.move-=1
                              oldField=this.field*1
                              newField=oldField*1+1
                              if(newField>=24){newField=0}
                              this.dx=gameboard[newField].cx-gameboard
                              [oldField].cx
                              this.dy=gameboard[newField].cy-gameboard
                              [oldField].cy
                              this.Field=newField
                              }
                              if (this.dx>0) {
                              this.dx-=2
                              this.currentX+=2
                              }
                              if(this.dy<0){
                              this.dy+=2
                              this.currentY-=2
                              }
                              if(this.dx<0){
                              this.dx+=2
                              this.currentX-=2
                              }
                              if(this.dy>0) {
                              this.dy-=2
                              this.currentY+=2
                              }

                              Well, this is the trouble.

                              By other side I am interested to modify text data on SVG using a SQL
                              database... is posible to do it?

                              Greetings and sorry for the inconveniences.

                              --- In svg-developers@yahoogroups.com, "jucabapa79"
                              <jucabapa79@y...> wrote:
                              > I repaired the board table and the pieces go straight to the left
                              as
                              > I plan but it still don't turn and go out of the game board...
                              >
                              > I will follow searching what is wrong...
                              >
                              > Greetings.
                              >
                              > --- In svg-developers@yahoogroups.com, "jucabapa79"
                              > <jucabapa79@y...> wrote:
                              > > Good afternoon.
                              > >
                              > > I review the code made by Mr. Holger and this is working
                              properly
                              > in
                              > > a 3 X 3 board, but I have troubles to make it run properly in a
                              6
                              > X
                              > > 6 board what I mean?
                              > >
                              > > First I made that my game pieces run in the down right corner,
                              but
                              > > when the pieces began to run using the throw button, they are
                              > > running first one space to the left and then one space down, and
                              > > they never go straight in one direction and also they go out of
                              > the
                              > > board.
                              > >
                              > > Would someone explain me what is going on? What do you suggest
                              to
                              > > correct this bug and made it run properly?
                              > >
                              > > Greetings.
                              > >
                              > > Travsam
                              > >
                              > > --- In svg-developers@yahoogroups.com, "jucabapa79"
                              > > <jucabapa79@y...> wrote:
                              > > > Mr. Holger, I will check the code made by you and study all
                              the
                              > > > properties, so I can adapt it to my game board, and also to
                              > learn
                              > > > more about scripting because for me it this the most difficult
                              > > thing
                              > > > in SVG.
                              > > >
                              > > > I will do my best.
                              > > >
                              > > > Travsam
                              > > >
                              > > > --- In svg-developers@yahoogroups.com, Holger Will
                              <holger@t...>
                              > > > wrote:
                              > > > > jucabapa79 schrieb:
                              > > > >
                              > > > > > Me again...
                              > > > > >
                              > > > > > As I told in some of the messages my dice will have two
                              > > > functions,
                              > > > > > the first one it was solved, but I still have troubles
                              with
                              > the
                              > > > > > second one.
                              > > > > >
                              > > > > > The objective is to move a piece in the sides of a square
                              > > board
                              > > > of
                              > > > > > 700*700 and I tried using the script down below.
                              > > > > >
                              > > > > > But any moment I try to load the SVG the javascript reader
                              > > gives
                              > > > an
                              > > > > > exception because is expecting an object, but all SVG is
                              > loaded
                              > > > > > properly, anyway anytime that I click on the "Throw"
                              button
                              > > gets
                              > > > the
                              > > > > > same mistake.
                              > > > > >
                              > > > > > Any suggestion?
                              > > > >
                              > > > > hi
                              > > > > ive written two small examples,
                              > > > > the first is a simple game framework. showing a simple
                              > gameloop.
                              > > > > http://www.treebuilder.de/svg/monopoly01.svg
                              > > > > the second is a basic monopoly framework,
                              > > > > http://www.treebuilder.de/svg/monopoly02.svg
                              > > > > study both examples, if you have any questions concerning
                              this
                              > > > code,
                              > > > > just ask.
                              > > > > cheers
                              > > > > Holger
                              > > > >
                              > > > > >
                              > > > > > Travsam
                              > > > > >
                              > > > > > <script type="text/ecmasscript">
                              > > > > > <![CDATA[
                              > > > > > /** The dice should move a piece in a board, the
                              > piece
                              > > is
                              > > > > > in the right down corner, the piece has first to
                              > > > > > move to the left, when it gets the corner will move
                              > up,
                              > > and
                              > > > > > so on, moving in the trayectory of the clock, the
                              > > > > > movement will be controled by a random number
                              between
                              > 1
                              > > and
                              > > > > > 6.
                              > > > > > */
                              > > > > >
                              > > > > > // svg variables
                              > > > > > var svgdoc;
                              > > > > > var svgroot;
                              > > > > >
                              > > > > > // game area variables
                              > > > > > var xMax = 700;
                              > > > > > var yMax = 700;
                              > > > > > var xMin = 100;
                              > > > > > var yMin = 100;
                              > > > > >
                              > > > > > // game variables
                              > > > > > var piece;
                              > > > > > var pieceX = 700;
                              > > > > > var pieceY = 700;
                              > > > > >
                              > > > > > function init (evt) {
                              > > > > >
                              > > > > > svgdoc = evt.getTarget().getOwnerDocument();
                              > > > > > svgroot = svgdoc.documentElement;
                              > > > > > piece = svgdoc.getElementbyId("piece");
                              > > > > >
                              > > > > > }
                              > > > > >
                              > > > > > // function throwDice, it will choose a number
                              between
                              > 1
                              > > > and
                              > > > > > 6 and set it as value "dice"
                              > > > > >
                              > > > > > function throwDice(){
                              > > > > >
                              > > > > > var randomDice=Math.round(Math.random()*5) + 1;
                              > > > > > dice = randomDice;
                              > > > > >
                              > > > > >
                              > > > > > }
                              > > > > > // function movePiece, first it will move the piece
                              to
                              > > the
                              > > > > > left, then it
                              > > > > > have to check when the piece arribes to the left
                              > corner
                              > > > then
                              > > > > > it moves up and so
                              > > > > > on, also it will use the counter "dice" that comes
                              > from
                              > > the
                              > > > > > throwDice function.
                              > > > > >
                              > > > > > function movePiece()
                              > > > > > {
                              > > > > >
                              > > > > > Do
                              > > > > > {
                              > > > > > pieceX = pieceX - 100;
                              > > > > > if pieceX = xMin and pieceY = yMax
                              > > > > > {
                              > > > > > pieceY = pieceY - 100;
                              > > > > > }
                              > > > > > else if pieceX = xMin AND pieceY = yMin
                              > > > > > {
                              > > > > > pieceX = pieceX + 100;
                              > > > > > }
                              > > > > > else if pieceX = xMax AND pieceY = yMin
                              > > > > > {
                              > > > > > pieceY = pieceY + 100;
                              > > > > > }
                              > > > > > Dice = Dice-1;
                              > > > > > piece.setAttribute("cx",pieceX);
                              > > > > > piece.setAttribute("cy",pieceY);
                              > > > > > }
                              > > > > > While Dice > 0;
                              > > > > >
                              > > > > > }
                              > > > > >
                              > > > > >
                              > > > > > // ]]>
                              > > > > >
                              > > > > > </script>
                              > > > > >
                            • Holger Will
                              Hi Travsam ... the code looks correct to me, could you put your complete file online somewhere ? if not, just send the file to my email adress. i guess its got
                              Message 14 of 18 , Jul 22, 2005
                                Hi Travsam


                                > Well, I tried to do all the possible things to fix the trouble with
                                > the trayectory of the board, first I configure the code sent by Mr.
                                > Holger to use it in a 7 X 7 board, then to check the differences
                                > between the program of Mr. Holger and adecuate them to my program
                                > and check the typos if there are.
                                >
                                > Anyway the pieces are still moving in a wrong way, even that I
                                > configure the board in different ways the pieces still go straight
                                > (what I mean with configure the board?, well, it means that I first
                                > put the initial position in the down right square (the bigger X and
                                > Y position on a graphic) of the board and then I put it on the up
                                > left square (the 0 position of X and Y on the board).
                                >
                                > But the trouble stays there, it looks like these code is getting me
                                > some troubles.
                                >
                                > if(this.dx==0 && this.dy==0 && this.move!=0) {
                                > this.move-=1
                                > oldField=this.field*1
                                > newField=oldField*1+1
                                > if(newField>=24){newField=0}
                                > this.dx=gameboard[newField].cx-gameboard
                                > [oldField].cx
                                > this.dy=gameboard[newField].cy-gameboard
                                > [oldField].cy
                                > this.Field=newField
                                > }
                                > if (this.dx>0) {
                                > this.dx-=2
                                > this.currentX+=2
                                > }
                                > if(this.dy<0){
                                > this.dy+=2
                                > this.currentY-=2
                                > }
                                > if(this.dx<0){
                                > this.dx+=2
                                > this.currentX-=2
                                > }
                                > if(this.dy>0) {
                                > this.dy-=2
                                > this.currentY+=2
                                > }
                                >
                                > Well, this is the trouble.

                                the code looks correct to me, could you put your complete file online
                                somewhere ? if not, just send the file to my email adress.
                                i guess its got something to do with your board representation.

                                >
                                > By other side I am interested to modify text data on SVG using a SQL
                                > database... is posible to do it?

                                yes you can comunicate with a DB via a server, using postURL() and
                                getURL(). on windows using IE + ASV you could also use ActiveX to
                                comunicate with any DB using ADO.

                                greetings
                                Holger

                                >
                                > Greetings and sorry for the inconveniences.
                                >
                                > --- In svg-developers@yahoogroups.com, "jucabapa79"
                                > <jucabapa79@y...> wrote:
                                > > I repaired the board table and the pieces go straight to the left
                                > as
                                > > I plan but it still don't turn and go out of the game board...
                                > >
                                > > I will follow searching what is wrong...
                                > >
                                > > Greetings.
                                > >
                                > > --- In svg-developers@yahoogroups.com, "jucabapa79"
                                > > <jucabapa79@y...> wrote:
                                > > > Good afternoon.
                                > > >
                                > > > I review the code made by Mr. Holger and this is working
                                > properly
                                > > in
                                > > > a 3 X 3 board, but I have troubles to make it run properly in a
                                > 6
                                > > X
                                > > > 6 board what I mean?
                                > > >
                                > > > First I made that my game pieces run in the down right corner,
                                > but
                                > > > when the pieces began to run using the throw button, they are
                                > > > running first one space to the left and then one space down, and
                                > > > they never go straight in one direction and also they go out of
                                > > the
                                > > > board.
                                > > >
                                > > > Would someone explain me what is going on? What do you suggest
                                > to
                                > > > correct this bug and made it run properly?
                                > > >
                                > > > Greetings.
                                > > >
                                > > > Travsam
                                > > >
                                > > > --- In svg-developers@yahoogroups.com, "jucabapa79"
                                > > > <jucabapa79@y...> wrote:
                                > > > > Mr. Holger, I will check the code made by you and study all
                                > the
                                > > > > properties, so I can adapt it to my game board, and also to
                                > > learn
                                > > > > more about scripting because for me it this the most difficult
                                > > > thing
                                > > > > in SVG.
                                > > > >
                                > > > > I will do my best.
                                > > > >
                                > > > > Travsam
                                > > > >
                                > > > > --- In svg-developers@yahoogroups.com, Holger Will
                                > <holger@t...>
                                > > > > wrote:
                                > > > > > jucabapa79 schrieb:
                                > > > > >
                                > > > > > > Me again...
                                > > > > > >
                                > > > > > > As I told in some of the messages my dice will have two
                                > > > > functions,
                                > > > > > > the first one it was solved, but I still have troubles
                                > with
                                > > the
                                > > > > > > second one.
                                > > > > > >
                                > > > > > > The objective is to move a piece in the sides of a square
                                > > > board
                                > > > > of
                                > > > > > > 700*700 and I tried using the script down below.
                                > > > > > >
                                > > > > > > But any moment I try to load the SVG the javascript reader
                                > > > gives
                                > > > > an
                                > > > > > > exception because is expecting an object, but all SVG is
                                > > loaded
                                > > > > > > properly, anyway anytime that I click on the "Throw"
                                > button
                                > > > gets
                                > > > > the
                                > > > > > > same mistake.
                                > > > > > >
                                > > > > > > Any suggestion?
                                > > > > >
                                > > > > > hi
                                > > > > > ive written two small examples,
                                > > > > > the first is a simple game framework. showing a simple
                                > > gameloop.
                                > > > > > http://www.treebuilder.de/svg/monopoly01.svg
                                > > > > > the second is a basic monopoly framework,
                                > > > > > http://www.treebuilder.de/svg/monopoly02.svg
                                > > > > > study both examples, if you have any questions concerning
                                > this
                                > > > > code,
                                > > > > > just ask.
                                > > > > > cheers
                                > > > > > Holger
                                > > > > >
                                > > > > > >
                                > > > > > > Travsam
                                > > > > > >
                                > > > > > > <script type="text/ecmasscript">
                                > > > > > > <![CDATA[
                                > > > > > > /** The dice should move a piece in a board, the
                                > > piece
                                > > > is
                                > > > > > > in the right down corner, the piece has first to
                                > > > > > > move to the left, when it gets the corner will move
                                > > up,
                                > > > and
                                > > > > > > so on, moving in the trayectory of the clock, the
                                > > > > > > movement will be controled by a random number
                                > between
                                > > 1
                                > > > and
                                > > > > > > 6.
                                > > > > > > */
                                > > > > > >
                                > > > > > > // svg variables
                                > > > > > > var svgdoc;
                                > > > > > > var svgroot;
                                > > > > > >
                                > > > > > > // game area variables
                                > > > > > > var xMax = 700;
                                > > > > > > var yMax = 700;
                                > > > > > > var xMin = 100;
                                > > > > > > var yMin = 100;
                                > > > > > >
                                > > > > > > // game variables
                                > > > > > > var piece;
                                > > > > > > var pieceX = 700;
                                > > > > > > var pieceY = 700;
                                > > > > > >
                                > > > > > > function init (evt) {
                                > > > > > >
                                > > > > > > svgdoc = evt.getTarget().getOwnerDocument();
                                > > > > > > svgroot = svgdoc.documentElement;
                                > > > > > > piece = svgdoc.getElementbyId("piece");
                                > > > > > >
                                > > > > > > }
                                > > > > > >
                                > > > > > > // function throwDice, it will choose a number
                                > between
                                > > 1
                                > > > > and
                                > > > > > > 6 and set it as value "dice"
                                > > > > > >
                                > > > > > > function throwDice(){
                                > > > > > >
                                > > > > > > var randomDice=Math.round(Math.random()*5) + 1;
                                > > > > > > dice = randomDice;
                                > > > > > >
                                > > > > > >
                                > > > > > > }
                                > > > > > > // function movePiece, first it will move the piece
                                > to
                                > > > the
                                > > > > > > left, then it
                                > > > > > > have to check when the piece arribes to the left
                                > > corner
                                > > > > then
                                > > > > > > it moves up and so
                                > > > > > > on, also it will use the counter "dice" that comes
                                > > from
                                > > > the
                                > > > > > > throwDice function.
                                > > > > > >
                                > > > > > > function movePiece()
                                > > > > > > {
                                > > > > > >
                                > > > > > > Do
                                > > > > > > {
                                > > > > > > pieceX = pieceX - 100;
                                > > > > > > if pieceX = xMin and pieceY = yMax
                                > > > > > > {
                                > > > > > > pieceY = pieceY - 100;
                                > > > > > > }
                                > > > > > > else if pieceX = xMin AND pieceY = yMin
                                > > > > > > {
                                > > > > > > pieceX = pieceX + 100;
                                > > > > > > }
                                > > > > > > else if pieceX = xMax AND pieceY = yMin
                                > > > > > > {
                                > > > > > > pieceY = pieceY + 100;
                                > > > > > > }
                                > > > > > > Dice = Dice-1;
                                > > > > > > piece.setAttribute("cx",pieceX);
                                > > > > > > piece.setAttribute("cy",pieceY);
                                > > > > > > }
                                > > > > > > While Dice > 0;
                                > > > > > >
                                > > > > > > }
                                > > > > > >
                                > > > > > >
                                > > > > > > // ]]>
                                > > > > > >
                                > > > > > > </script>
                                > > > > > >
                                >
                                >
                                >
                                >
                                > -----
                                > To unsubscribe send a message to:
                                > svg-developers-unsubscribe@yahoogroups.com
                                > -or-
                                > visit http://groups.yahoo.com/group/svg-developers and click "edit my
                                > membership"
                                > ----
                                >
                                >
                                > ------------------------------------------------------------------------
                                > YAHOO! GROUPS LINKS
                                >
                                > * Visit your group "svg-developers
                                > <http://groups.yahoo.com/group/svg-developers>" on the web.
                                >
                                > * To unsubscribe from this group, send an email to:
                                > svg-developers-unsubscribe@yahoogroups.com
                                > <mailto:svg-developers-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                                >
                                > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                                > Service <http://docs.yahoo.com/info/terms/>.
                                >
                                >
                                > ------------------------------------------------------------------------
                                >
                              Your message has been successfully submitted and would be delivered to recipients shortly.