Change font size
It is currently Mon May 20, 2013 2:45 am

Forum rules


Image



Post a new topicPost a reply Page 2 of 3   [ 27 posts ]
Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Trying to find....
PostPosted: Tue Jun 12, 2012 3:10 am 
OSG Elite

Joined: Tue Dec 21, 2010 8:01 pm
Posts: 349
This chess board is great Cam thank you! I do have one question... :) Any idea how you make it take a piece off the board if you capture it, or add a piece (queening) short of deleting the piece?


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Tue Jun 12, 2012 7:18 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
I have been working on adding functionality to this board, have run into several problems.
So far I have restricted movements to allowable moves according to the rules of checkers (up to a point) white moves diagonally up till it hits the top then is allowed to move in both directions, vice-versa for black.
Reaching the top reveals hover text (KING) because I havent yet figured out how to add more pieces to the link set in the correct link number && then moving 2 child link parts as a single item within a link set which brings its own problems.
The next problem is having the board be aware of where each piece is at every step of the game, so it knows when there is a opposition piece in the right place to allow the "jump" move, struggling a bit with that.

In answer to your question Walter, I have added 2 extra prims (one at each end of the board) to act as "Home", this is where "taken" pieces will end up, still within the link-set but off the actual board, The list of co-ords gets extended +2 positions on the y axis for the black, and -2 positions on the y axis for the white. this would give 16 spare spots each for taken pieces. I might modify V0.3 to allow for this, before posting the complete game.

Also running into a strange issue where getting a precise y co-ord on the board should be 1.5, but system returns (example) 1.5000175, so I had to use a workaround (llRound (finalpos.y*100))*.01; to remove the erroneous parts.


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Tue Jun 12, 2012 10:28 am 
Furious Typer

Joined: Mon Apr 25, 2011 6:48 pm
Posts: 70
Cam,

I played around with the scripts night before last, and came across many of the same issues.

As for keeping track of what piece is where, this could easily be done with a list. In the zero based setup you have, (xPos + 1) * (yPos + 1) would give you squares 1 thru 64. I created a list using two for loops hooked into your x and y values to generate the 64 item list, giving a value to each square along with the named piece that existed in that square. I was playing with chess in mind. As I did this, the only issue I encountered, and why I stopped for the night, was because I hadn't coded specific link numbers. I've found inconsistancy when obtaining and sending the link number on each llMessageLinked call, so I sent the number from each piece on state_entry, and saved them to a variable. Then I can refer to the piece in question simply by the variable. Lots of 'if' statements.

As for moving multiple prims, wouldn't it just be easier to grow the 'King', making the piece taller, and doubling the texture along the prim side face to indicate two. This cuts down on programming at least.

I had thought about adding the extra spaces for moving pieces off the board, but hadn't pursued anything yet.

Would like to see about having the pieces taken into the boards inventory, and being placed on rez.


Here's the code as it stands right now. How you can find something useful.

Game Board
Code:
//Simple chess board script V0.3
//by Cam Chevalier
//09-June-2012
integer width = 8;
integer height = 8;

string strChildName;
integer intChildNum;

list listBoard;


default
{
    state_entry()
    {
        integer idxBoard_XPos;
        integer idxBoard_YPos;
       
        for (idxBoard_XPos = 1; idxBoard_XPos <= 8; idxBoard_XPos = idxBoard_XPos + 1)
        {
            for (idxBoard_YPos = 1; idxBoard_YPos <= 8; idxBoard_YPos = idxBoard_YPos + 1)
            {
                if (idxBoard_XPos == 1)
                {
                    if (idxBoard_YPos == 1)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RRook"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 2)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RKnight"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 3)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RBishop"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 4)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_King"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 5)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_Queen"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 6)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LBishop"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 7)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LKnight"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 8)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LRook"], idxBoard_XPos * idxBoard_YPos);
                    }
                }
                else if (idxBoard_XPos == 2)
                {
                    if (idxBoard_YPos == 1)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RPawn4"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 2)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RPawn3"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 3)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RPawn2"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 4)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_RPawn1"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 5)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LPawn1"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 6)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LPawn2"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 7)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LPawn3"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 8)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "White_LPawn4"], idxBoard_XPos * idxBoard_YPos);
                    }
                }
                else if (idxBoard_XPos == 7)
                {
                    if (idxBoard_YPos == 1)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RRook"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 2)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RKnight"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 3)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RBishop"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 4)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_King"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 5)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_Queen"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 6)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LBishop"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 7)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LKnight"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 8)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LRook"], idxBoard_XPos * idxBoard_YPos);
                    }
                }
                else if (idxBoard_XPos == 8)
                {
                    if (idxBoard_YPos == 1)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RPawn4"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 2)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RPawn3"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 3)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RPawn2"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 4)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_RPawn1"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 5)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LPawn1"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 6)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LPawn2"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 7)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LPawn3"], idxBoard_XPos * idxBoard_YPos);
                    }
                    if (idxBoard_YPos == 8)
                    {
                        listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "Black_LPawn4"], idxBoard_XPos * idxBoard_YPos);
                    }
                }
                else
                {
                    listBoard = llListInsertList(listBoard, [(string)idxBoard_XPos + "|" + (string)idxBoard_YPos + "|" + "EMPTY"], idxBoard_XPos * idxBoard_YPos);
                }
            }
        }
    }
   
    link_message(integer sender_num, integer num, string str, key id)
    {
        strChildName = str;
        intChildNum = num;
    }

    touch_start(integer b)
    {
        integer idxBoard_XPos;
        integer idxBoard_YPos;

        vector st = llDetectedTouchST(0);
        integer x = llFloor(st.x * width);
        integer y = llFloor(st.y * height);
        integer xPos = x + 1;
        integer yPos = y + 1;
        integer idxBoardPos = xPos * yPos;
        vector size = llGetScale();
        float wFactor = size.x/8;
        float wstep = wFactor/2;
        float hFactor = size.y/8;
        float hstep = hFactor/2;
        float tFactor;  //=size.z;
        vector finalpos;
        vector placex;
        vector placexy;
               
       
        if (x == 0)
        {
            placex = ( - <wstep + wFactor * 3, 0, 0>);
        }
        if (x == 1)
        {
            placex = ( - <wstep + wFactor * 2, 0, 0>);
        }
        if (x == 2)
        {
            placex = ( - <wstep + wFactor, 0, 0>);
        }
        if (x == 3)
        {
            placex = ( - <wstep, 0, 0>);
        }
        if (x == 4)
        {
            placex = ( <wstep, 0, 0>);
        }
        if (x == 5)
        {
            placex = ( <wstep + wFactor,0,0>);
        }
        if (x == 6)
        {
            placex = ( <wstep + wFactor*2,0,0>);
        }
        if (x == 7)
        {
            placex = ( <wstep + wFactor*3,0,0>);
        }
       
        if (y == 0)
        {
            placexy = (placex - <0, hstep + hFactor * 3, 0>);
        }
        if (y == 1)
        {
            placexy = (placex - <0, hstep + hFactor * 2, 0>);
        }
        if (y == 2)
        {
            placexy = (placex - <0, hstep + hFactor, 0>);
        }
        if (y == 3)
        {
            placexy = (placex - <0, hstep, 0>);
        }
        if (y == 4)
        {
            placexy = (placex + <0, hstep, 0>);
        }
        if (y == 5)
        {
            placexy = (placex + <0, hstep + hFactor, 0>);
        }
        if (y == 6)
        {
            placexy = (placex + <0, hstep + hFactor * 2, 0>);
        }
        if (y == 7)
        {
            placexy = (placex + <0, hstep + hFactor * 3, 0>);
        }
       

        if (strChildName == "White_King")
        {
            tFactor = size.z + 0.65;
        }
        if (strChildName == "White_Queen")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "White_LBishop")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "White_RBishop")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "White_LKnight")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_RKnight")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_LRook")
        {
            tFactor = size.z + 0.4;
        }
        if (strChildName == "White_RRook")
        {
            tFactor = size.z + 0.4;
        }
        if (strChildName == "White_LPawn1")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_RPawn1")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_LPawn2")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_RPawn2")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_LPawn3")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_RPawn3")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_LPawn4")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "White_RPawn4")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_King")
        {
            tFactor = size.z + 0.65;
        }
        if (strChildName == "Black_Queen")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "Black_LBishop")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "Black_RBishop")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "Black_LKnight")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_RKnight")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_LRook")
        {
            tFactor = size.z + 0.4;
        }
        if (strChildName == "Black_RRook")
        {
            tFactor = size.z + 0.4;
        }
        if (strChildName == "Black_LPawn1")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_RPawn1")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_LPawn2")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_RPawn2")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_LPawn3")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_RPawn3")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_LPawn4")
        {
            tFactor = size.z + 0.05;
        }
        if (strChildName == "Black_RPawn4")
        {
            tFactor = size.z + 0.05;
        }
       
       
        //for (idxBoard_XPos = 1; idxBoard_XPos <= 8; idxBoard_XPos = idxBoard_XPos + 1)
        //{
            //for (idxBoard_YPos = 1; idxBoard_YPos <= 8; idxBoard_YPos = idxBoard_YPos + 1)
            //{
                //if (strChildName == llList2String(llParseString2List(llList2String(listBoard, idxBoard_XPos * idxBoard_YPos), ["|"], []), 2))
                //{
                //    listBoard = llListReplaceList(listBoard, [(string)x + "|" + (string)y + "|" + "EMPTY"], idxBoard_XPos * idxBoard_YPos, idxBoard_XPos * idxBoard_YPos);
                //}
                //if (x == llList2Integer(llParseString2List(llList2String(listBoard, idxBoard_XPos * idxBoard_YPos), ["|"], []), 0))
                //{
                    //if (y == llList2Integer(llParseString2List(llList2String(listBoard, idxBoard_XPos * idxBoard_YPos), ["|"], []), 1))
                    //{
                        //if (llGetSubString(llList2String(llParseString2List(llList2String(listBoard, idxBoard_XPos * idxBoard_YPos), ["|"], []), 2), 0, 3) != llGetSubString(strChildName, 0, 3))
                        //{
                            //listBoard = llListReplaceList(listBoard, [(string)x + "|" + (string)y + "|" + strChildName], idxBoard_XPos * idxBoard_YPos, idxBoard_XPos * idxBoard_YPos);
                            finalpos = placexy + <0, 0, tFactor>;
               
                            llMessageLinked(intChildNum, 0, (string)finalpos + "|" + (string)x + "|" + (string)y, NULL_KEY);
                        //}
                        //else
                        //{
                           
                        //}
                    //}
                //}
            //}
        //}
       
        llSetText(strChildName + " to " + (string)x + ", " + (string)y, <0.0, 1.0, 0.0>, 1.0);
       
    }
}


Game Piece
Code:
//piece script V-0.3
//by Cam Chevalier
//09-June-2012
vector vecPieceCoords;
string strPieceName;

default
{
    state_entry()
    {
        strPieceName = llGetObjectName();
    }
   
    touch_start(integer b)
    {
        llMessageLinked(LINK_ROOT, llGetLinkNumber(), strPieceName, NULL_KEY);
    }
   
    link_message(integer sender_num, integer num, string str, key id)
    {
        integer xPos;
        integer yPos;
       
        vecPieceCoords = llList2Vector(llParseString2List(str, ["|"], []), 0);
        xPos = llList2Integer(llParseString2List(str, ["|"], []), 1);
        yPos = llList2Integer(llParseString2List(str, ["|"], []), 2);
       
        llSetPos(vecPieceCoords);
        llSetText(strPieceName + "\n" + (string)xPos + ", " + (string)yPos, <1.0, 1.0, 1.0>, 1.0);
    }
}


The Game Piece code depends on the prim being named something unique. In this case White_LeftPawn1 or Black_Queen.



Shad MOrdre


Attachments:
ScriptedChessBoard_001.png
ScriptedChessBoard_001.png [ 461.19 KiB | Viewed 393 times ]
Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Thu Jun 14, 2012 12:39 am 
OSG Elite

Joined: Tue Dec 21, 2010 8:01 pm
Posts: 349
Tried the new code. Did have an odd issue.. The Queens, Kings, Rooks and Bishops now fly over the board when moved. The Knights and Pawns are ok however. Any idea?


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Thu Jun 14, 2012 1:30 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
Hey Walter,
I didnt write that latest V0.3 Shad did.
but a cursory glance of the code shows
Code:
        if (strChildName == "Black_RKnight")
        {
            tFactor = size.z + 0.05;
        }
and
Code:
                if (strChildName == "White_LPawn4")
        {
            tFactor = size.z + 0.05;
        }
for all the pawns.., but shows
Code:
        if (strChildName == "Black_LRook")
        {
            tFactor = size.z + 0.4;
        }
and
Code:
if (strChildName == "Black_King")
        {
            tFactor = size.z + 0.65;
        }
        if (strChildName == "Black_Queen")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "Black_LBishop")
        {
            tFactor = size.z + 0.5;
        }
        if (strChildName == "Black_RBishop")
        {
            tFactor = size.z + 0.5;
        }
my guess is a typo where Black King for example should probably be something like tFactor=size.z+0.065 instead of tFactor=size.z+0.65, which would put the offending pieces half a meter up from the rest of the items, this mod also seems to rely on fixed sizes for the pieces which would depend on the board being a fixed size, I would have used a percentage factor to set the pieces rather than a fixed size.
Cam


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Thu Jun 14, 2012 2:27 am 
Furious Typer

Joined: Mon Apr 25, 2011 6:48 pm
Posts: 70
My bad.

The code I posted was really hacked. Yes, the code was written as Cam stated, for fixed sized game pieces. Nice tip about the percentages, Cam. I'll certainly integrate that. The original code you had posted had the game pieces kinda sunk into the board, and my hack was to get them out. My bad.

I posted in hopes that you could take some ideas from the code and maybe find some tips yourself. :D

I had thought that coding for chess wouldn't take much, basically define which piece can move in what way. The commented code section at the bottom was me trying to make sure game pieces couldn't land on a square that already had a game piece of the same color, and tracking in the list, where all the pieces were. It really didn't work as I had hoped. Was hoping you could make some sense of it, and apply your expertise to some mods.

Dunno if you like folks playing with your code in progress, but I enjoy coding, and currently have nothing better to do to occupy my time. :lol:

I certainly don't mind collaborative projects.

Shad MOrdre


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Thu Jun 14, 2012 3:57 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
Shad,
I am happy for anyone to use misuse and abuse the code, it was developed with open source in mind, and I am certainly guilty of releasing code with typos from time to time, so no issue there.
I also like the collaborative effort where people can take code and improve it and release it back to the wild for all to use, this way more content gets created.

My original design called for the board to be the same thickness as the height of the pieces, after consideration this is not the best idea, so I am working on a new way of finding the perfect height to place the pieces, being half of the height of the piece (center of the prim) to be the distance up from the top of the board, so regardless of the size of board and pieces, it will work for all configurations, which is always a good failsafe.

I am still working on checkers because in chess there are many different moves, I just think how many variables are just for the knight and my head swims, so baby steps, I will release checkers first.


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Sun Jun 17, 2012 5:21 am 

Joined: Thu Jun 07, 2012 3:59 pm
Posts: 10
Hmmm, it's nice seeing a bit of discussion happening :) I wasn't quite expecting this to happen.

On a slightly different note, I did try Shad's code from above. I'm probably doing sometthing really stupid, but when I tried, it ended up sending up everything to 0,0,0. Looking at some of the comments above, it might simply be that I'm trying to use chess pieces that are more than one prim (the one thing I didn't try) but if someone could clarify this it'd be appreciated.


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Sun Jun 17, 2012 6:06 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
Hi dog, yes you already have part of the solution, the script does not allow for the pieces to be more than one prim,
Also my guess is that you have not linked everything, the script is designed for linked pieces to communicate with each other, also linking makes all the positions relative to the root prim, if they are not linked then the final command llSetPos(vecPieceCoords); will return 0,0,0 and that where touched pieces will end up.
My code calls for all the pieces to be selected then the board selected last, then link, this will produce the board as the root prim, I believe Shads code has the same arrangement.
Cam.
ps. I am having major problems having the system agree that 1.50000 ==1.50000, so I am stuck there, I may have to post the unfinished code and let others help with a solution.


Top
 Profile  
 
 Post subject: Re: Trying to find....
PostPosted: Sun Jun 17, 2012 6:40 am 

Joined: Thu Jun 07, 2012 3:59 pm
Posts: 10
Thanks for the reply Cam. certianly sounds like somethign fairly trivial that I overlooked :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 3   [ 27 posts ]
Go to page Previous  1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net