1: If the variable is equal to zero, the variable is replaced when "Load" is called. That, and it does the fancy stuff afterward. Of course, the fancy stuff messes up if the non-facy stuff (below) doesn't function properly! Weird part is that it all works properly for p100-p144!
CODE
//Script (c) 2006 Moaku Mostel
string sub;
integer color;
integer new_color;
string pl = "Player1";
list loads;
list checks;
//Load amount = How many left to load
//Load increment = How many blocks to add to load_amount when the max load turns have been reached
integer load_amount;
integer current_load = 5; //How many tiles to add when load is called.
integer max_load_turns; //Now has become a pointless variable.
integer current_load_turns; //Anso rendered a pointless variable. ><
//Stores where colors are
integer p180; integer p181; integer p182; integer p183; integer p184;
integer p160; integer p161; integer p162; integer p163; integer p164;
integer p140; integer p141; integer p142; integer p143; integer p144;
integer p120; integer p121; integer p122; integer p123; integer p124;
integer p100; integer p101; integer p102; integer p103; integer p104;
say_load()
{
//States where the colors are.
llSay(0,"Debug: Row 5= "+(string)p180+" "+(string)p181+" "+(string)p182+" "+(string)p183+" "+(string)p184);
llSay(0,"Debug: Row 4= "+(string)p160+" "+(string)p161+" "+(string)p162+" "+(string)p163+" "+(string)p164);
llSay(0,"Debug: Row 3= "+(string)p140+" "+(string)p141+" "+(string)p142+" "+(string)p143+" "+(string)p144);
llSay(0,"Debug: Row 2= "+(string)p120+" "+(string)p121+" "+(string)p122+" "+(string)p123+" "+(string)p124);
llSay(0,"Debug: Row 1= "+(string)p100+" "+(string)p101+" "+(string)p102+" "+(string)p103+" "+(string)p104);
llSay(0,"Adding one.");
llMessageLinked(LINK_SET,0,"Load",NULL_KEY);
}
add_tiles()
{
integer i;
integer z = llGetListLength(loads);
for (i = 0; i < z; i++)
{
llMessageLinked(LINK_SET,0,llList2String(loads,i),NULL_KEY);
llMessageLinked(LINK_SET,0,llList2String(checks,i),NULL_KEY);
}
}
random(integer tile)
{
//The list is generated here. ID is the tile, Make_X is the potential color.
string make_x;
string id = "0"+(string)tile;
string chk;
float z = llFrand(3200);
if (z > 3000)
{
chk = "0check";
make_x = "MakeRow";
}
else if (z > 2800)
{
chk = "0check";
make_x = "MakeCol";
}
else if (z > 2600)
{
chk = "0check";
make_x = "MakeExplosion";
}
else if (z > 2400)
{
chk = "0check";
make_x = "MakeHP2";
}
else if (z > 2200)
{
chk = "0check";
make_x = "MakeHP1";
}
else if (z > 2000)
{
chk = "0check";
make_x = "MakeHPEX";
}
else if (z > 1900)
{
chk = "0check";
make_x = "MakeHP2";
}
else if (z > 1800)
{
chk = "0check";
make_x = "MakeHP1";
}
else if (z > 1700)
{
chk = "0check";
make_x = "MakeEX2";
}
else if (z > 1600)
{
chk = "0check";
make_x = "MakeEX1";
}
else if (z > 1500)
{
chk = "1check";
make_x = "MakeRed";
}
else if (z > 1000)
{
chk = "2check";
make_x = "MakeBlue";
}
else if (z > 500)
{
chk = "4check";
make_x = "MakeYellow";
}
else if (z > 0)
{
chk = "3check";
make_x = "MakeGreen";
}
loads = loads + [make_x+id+pl];
checks = checks + [chk+id+pl];
}
clear_list()
{
loads = [];
checks = [];
}
default
{
touch(integer num_detected)
{
say_load();
}
state_entry()
{
//llSay(0, "Welcome to La'Mora Mu'Kora!");
}
link_message(integer sender_num, integer num, string str, key id)
{
sub = llGetSubString(str,6,9);
color = (integer)llGetSubString(str,0,0);
if (sub == "0100")
{
p100 = color;
}
if (sub == "0101")
{
p101 = color;
}
if (sub == "0102")
{
p102 = color;
}
if (sub == "0103")
{
p103 = color;
}
if (sub == "0104")
{
p104 = color;
}
if (sub == "0120")
{
p120 = color;
}
if (sub == "0121")
{
p121 = color;
}
if (sub == "0122")
{
p122 = color;
}
if (sub == "0123")
{
p123 = color;
}
if (sub == "0124")
{
p124 = color;
}
if (sub == "0140")
{
p140 = color;
}
if (sub == "0141")
{
p141 = color;
}
if (sub == "0142")
{
p142 = color;
}
if (sub == "0143")
{
p143 = color;
}
if (sub == "0144")
{
p144 = color;
}
if (sub == "0160")
{
p160 = color;
}
if (sub == "0161")
{
p161 = color;
}
if (sub == "0162")
{
p162 = color;
}
if (sub == "0163")
{
p163 = color;
}
if (sub == "0164")
{
p124 = color;
}
//======
if (str == "Load")
{
//Current color, new color, tile
load_amount = current_load;
if(p100 ==0 && load_amount > 1)
{
random(100);
load_amount -=1;
}
if(p101 ==0 && load_amount > 1)
{
random(101);
load_amount -=1;
}
if(p102 ==0 && load_amount > 1)
{
random(102);
load_amount -=1;
}
if(p103 ==0 && load_amount > 1)
{
random(103);
load_amount -=1;
}
if(p104 ==0 && load_amount > 1)
{
random(104);
load_amount -=1;
}
if(p120 == 0 && load_amount > 1)
{
random(120);
load_amount -=1;
}
if(p121 == 0 && load_amount > 1)
{
random(121);
load_amount -=1;
}
if(p122 == 0 && load_amount > 1)
{
random(122);
load_amount -=1;
}
if(p123 ==0 && load_amount > 1)
{
random(123);
load_amount -=1;
}
if(p124 ==0 && load_amount > 1)
{
random(124);
load_amount -=1;
}
if(p140 ==0 && load_amount > 1)
{
random(140);
load_amount -=1;
}
if(p141 ==0 && load_amount > 1)
{
random(141);
load_amount -=1;
}
if(p142 ==0 && load_amount > 1)
{
random(142);
load_amount -=1;
}
if(p143 ==0 && load_amount > 1)
{
random(143);
load_amount -=1;
}
if(p144 ==0 && load_amount > 1)
{
random(144);
load_amount -=1;
}
if(p160 ==0 && load_amount > 1)
{
random(160);
load_amount -=1;
}
if(p161 ==0 && load_amount > 1)
{
random(161);
load_amount -=1;
}
if(p162 ==0 && load_amount > 1)
{
random(162);
load_amount -=1;
}
if(p163 ==0 && load_amount > 1)
{
random(163);
load_amount -=1;
}
if(p164 ==0 && load_amount > 1)
{
random(164);
load_amount -=1;
}
if(p180 ==0 && load_amount > 1)
{
random(180);
load_amount -=1;
}
if(p181 ==0 && load_amount > 1)
{
random(181);
load_amount -=1;
}
if(p182 == 0&& load_amount > 1)
{
random(182);
load_amount -=1;
}
if(p183 ==0 && load_amount > 1)
{
random(183);
load_amount -=1;
}
if(p184 ==0 && load_amount > 1)
{
random(184);
load_amount -=1;
}
add_tiles();
if(load_amount > 0)
{
float temp;
temp = .010 * load_amount;
llMessageLinked(LINK_ALL_OTHERS,0,"Damage"+pl+(string)temp,NULL_KEY);
}
clear_list();
}
if(llGetSubString(str,0,11) == "LoadIncrease")
{
current_load += (integer)llGetSubString(str,12,-1);
}
if(llGetSubString(str,0,0) == "InitialLoadSet")
{
current_load = (integer)llGetSubString(str,13,-1);
}
}
}
Now, here's the problems.
1: Sometimes it deletes or replaces an existing variable, even if the variable that the color is stored in is not equal to zero!
2: For some reason, after the third or fourth row of variables (p140-p164), it likes to replace the variable at p124...
This is the output.
First time around:
Object: Debug: Row 5= 0 0 0 0 0
Object: Debug: Row 4= 4 3 1 2 0
Object: Debug: Row 3= 3 2 3 3 3
Object: Debug: Row 2= 2 4 4 2 2 <---Not a zero.
Object: Debug: Row 1= 3 4 2 1 2
Afterward:
Object: Debug: Row 5= 0 0 0 0 0
Object: Debug: Row 4= 4 3 1 2 0
Object: Debug: Row 3= 3 2 3 3 3
Object: Debug: Row 2= 2 4 4 2 0 <---This is replaced? How?
Object: Debug: Row 1= 3 4 2 1 2
3: Variables p180-p184 are ignored for a while. I -REALLY- hope this isn't the IF statement issue I had in the past where if statements are ignore despite the conditions are met. Numbers one and two are more important.