Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scoreboard

Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 12:02
I need to make a scoreboard for use with my combat system.

This is what it needs to do.
When someone dies, the HUD communicates (most likely shouting) with the scoreboard, tells who died and who killed who. Now, I want it to display using zyText a list of the people who been killing/dying for the past 24 hours (have it reset at midnight). It needs to ADD the name of the person killing and dying to the list, but if the person is on the list it wont add them again.

Here's my questions.
Whats the best approach for this?
HOW do you "add people to the list"? I am guessing you use lists in LSL but I am not too sure.
How do you even use zyText? The example at the wiki doesn't compile for me.

Thanks for any help.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-26-2007 13:14
Never used XYText.. played with it a bit.. but never really worked it out.

As far as adding members to a list, use the list variable type.. define a global list variable before the default state.

list AvList;

default
{ ....


then, use llListFindList to check the list for the avatar name.. not sure how you're detecting the name of the avatar.. but however you get the name.. let's say the avatar to be checked is stored in a string variable called "AvName". llListFindList returns a number.. that number is the position in the list (starting from 0), if the number returned is -1, then the list search didnt find the name.. and you'd want to add the name... Then you'd do something like this:

integer test = llListFindList (AvList, AvName);

if (test == -1)
{
AvList += AvName;
}

That would add the name to the list... you could use llListFindList to remove names as well. Remember the number returned is the position, so if you want to remove the name, you'd use list find list to find the postion of that name in the list then remove it using (um...) llDeleteSubList(); (I think...)

you're going to have to study lists in the wiki to learn about them, and how to use them.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
08-26-2007 13:33
Do a forum search for XyText, you're spelling it zyText - that could be some of the problem. The scripts for XyText on lslwiki.net should work just fine. But you really need to play with it and understand what it does. XyText is not a single script, it is a system... and there are a variety of options; 3 chars/prim, 6 chars/prim, 5 chars/prim, and 10 chars/prim. My personal preference is the 5 chars/prim version. There are also setup scripts that create the prim needed to properly display the text. And finally, there is a script you have to write yourself before XyText does anything at all! The actual XyText script is just a display handler... you have to send it data from your own custom script.

As for the list, I would make a list that is pre-filled with empty text... say for a top-10, your list would be:
list frag_list = ["", "", "", "", "", "", "", "", "", ""];

Then, whenever you need to add a name, do:
frag_list = llKey2Name(new_frag) + frag_list;

Finally, delete the last name from the list:
frag_list = llList2List(frag_list, 0, 9);
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 13:59
Thanks! I forgot that its xy not zy...

I will be looking at the xyText and figuring it out, then I'll work on the lists. Thanks for the info.

Now about the lists...how can I make it so that it'll save EVERY person's info and name for 24 hours? Do i just make it so the list has about maybe 100 or more empty spots and have the board display 10 of those?
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
08-26-2007 14:15
Ah... yeah, don't pre-fill the list with empty spaces and don't do the last step in my post. Add to the list, but don't delete. Just be cautious about memory... when you start to fill lists without a limit, there's a chance you can run out of script memory and your script will crash. That shouldn't be a problem if you remove duplicate names.

So I guess your workflow would be:
1. define a global list

when a new frag comes in:
2. check if the name exists in the list..
2a. if not, add it to the beginning
2b. if yes, remove the old name, add the new name to beginning (I imagine you'd like the most recent shown at the top of the list? otherwise, do nothing if it already exists.)

3. convert the top 10 (or however many need to displayed) to strings and send to XyText.

In this case, I would probably dump the list to a string and send one message to the display board. Then, I'd mod the XyText script to sort and handle the message as needed. For example, row 1 would grab on the first name from the list.

On the other hand, you could use un-modified XyText, and build a loop into your sending script... that would send one name per XyText row (XyText rows are something you have to setup and configure on your own).
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 14:48
Awesome. I've been playing with xyText for a little, its interesting. I'm only having one issue!! How to LINK them so they work together. I am trying to thigns but it just comes with syntax errors.

CODE

// Channel to set the line with
integer SET_LINE_CHANNEL = 100100;


integer ThisLink = llGetLinkNumber();
// Set up each prim to listen on the same channel, but to render only a part of the string.
llMessageLinked(ThisLink , SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 0]), "");
llMessageLinked(ThisLink + 1, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 6]), "");
llMessageLinked(ThisLink + 2, SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 12]), "");


llMessageLinked(LINK_SET, SET_LINE_CHANNEL, "Long line of text.", "");

None of that works at all, and its confusing because I don't understand WHY it wont.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-26-2007 14:56
Not sure if this is the syntax error you're getting, but one hopes the compiler might fuss about getting a null string for the last argument of llMessageLinked, instead of NULL_KEY.
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 15:06
Ok this line is whats giving me an error too.

integer ThisLink = llGetLinkNumber();


and so does the ThisLink in

llMessageLinked(ThisLink , SET_CELL_INFO, llList2CSV([SET_LINE_CHANNEL, 0]), "";);
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
08-26-2007 16:13
What's the error you get? You might've mis-capitalized your variable name, "ThisLink", somewhere within the script.

As for linking, start at the last prim, then shift-select each prim (one-by-one) in order from end of the row to the front. Select the root prim last. In a setup where you have a non-display root prim, then 3 display prims in a row.... you'll should have the link order:

root = 1, 1st display = 2, 2nd = 3 and 3rd = 4.
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 16:18
Okay well, I got the whole xyText thing figured out. Thanks for helping people.

Now I am doing the list, and i'm having trouble seeing how its done, but I"ll keep toying with it until i get it unless there's examples or more things i should know?

I have five lines and 50 characters each. Should I use seperate lists for each line? I want it to show the latest kills (and total amount of deaths in the match) and thats it, for now.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-26-2007 16:34
well if your gonna use 5 different list for 5 different elements just forget list's and use strings

using either you would want to trim your input strings to 50 characters , which can be done ezly enough with llGetSubstring

using a list you store that like

list data += input_string;

then later on when you want to recall the information do a llList2String(data, 0) for the first element
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-26-2007 18:45
Okay thanks for the help everyone. I figured it out and its up and running, I modified another board I had and now it works perfect for now! Thanks.