Code: Select all
Script 9 (void)
{
Print(s:"Determining your score.");
int i=0;
int j=0;
int x=1;
i=0;
for(i=0;i<6;i++)
{
equal_amount[i]=0;
}
i=0;
for(i=0;i<6;i++)
{
Print(d:dice[i]);
}
i=0;
for(x=1;x < 7;x++) //checks for each possible dice value
{
i=0;
for(i=0;i<6;i++) //checks for each dice
{
if(dice[i]==x) //checks if each dice is equal to certain number
{
equal_amount[j]++; //if current dice is equal to current number, adds 1, determining amount of dice = certain number
}
Delay(1);
}
j++;
Delay(1);
}
Print(s:"Got this far 1");
i=0;
for(i=0;i<6;i++)
{
Print(d:equal_amount[i]);
}
i=0;
j=0;
int y;
int z;
for(j=0;j<6;j++) //checks each amount of dice equal to each number
{
if(equal_amount[j]==6) //if amount of (dice = certain number) = this many, set score.
{
GiveActorInventory(900+current_turn,"Points",3000); //score[current_turn]=3000;
ACS_Terminate(9,1); //scoreflag=1;
}
else if(equal_amount[j]==5)
{
if(j != 0) //if (5 of a kind) is not 1s, check for extra 1
{
GiveActorInventory(900+current_turn,"Points",2000+(100*equal_amount[0]));
ACS_Terminate(9,1);
}
else if(j != 4) //if (5 of a kind) is not 5s, check for extra 5
{
GiveActorInventory(900+current_turn,"Points",2000+(100*equal_amount[4]));
ACS_Terminate(9,1);
}
else //no extra 1s or 5s
{
GiveActorInventory(900+current_turn,"Points",2000);
ACS_Terminate(9,1);
}
}
else if(equal_amount[j]==4)
{
if(j != 0 && j != 4) //if (4 of a kind) is not 1s or 5s, check for extra 1s or 5s
{
GiveActorInventory(900+current_turn,"Points",1000+(100*equal_amount[0])+(50*equal_amount[4]));
ACS_Terminate(9,1);
}
else if(j != 0) //if (4 of a kind) is not 1s, check for extra 1s
{
GiveActorInventory(900+current_turn,"Points",1000+(100*equal_amount[0]));
ACS_Terminate(9,1);
}
else if(j != 4) //if (4 of a kind) is not 5s, check for extra 5s
{
GiveActorInventory(900+current_turn,"Points",1000+(50*equal_amount[4]));
ACS_Terminate(9,1);
}
else //no extra 1s or 5s
{
GiveActorInventory(900+current_turn,"Points",1000);
ACS_Terminate(9,1);
}
}
else if(equal_amount[j]==3)
{
int flag=0;
i=0;
for(i=0;i<6;i++)
{
if(equal_amount[j]==equal_amount[i] && j != i)
{
GiveActorInventory(900+current_turn,"Points",2500); //score[current_turn]=2500;
ACS_Terminate(9,1);
flag=1;
}
Delay(1);
}
if(flag != 1)
{
if(j != 0 && j != 4) //if (3 of a kind) is not 1s or 5s, check for 1s and 5s
{
GiveActorInventory(900+current_turn,"Points",((j+1)*100)+(100*equal_amount[0])+(50*equal_amount[4]));
ACS_Terminate(9,1);
}
else if(j != 0) //if (3 of a kind) is not 1s, check for 1s
{
GiveActorInventory(900+current_turn,"Points",((j+1)*100)+(100*equal_amount[0]));
ACS_Terminate(9,1);
}
else if(j==0) //if (3 of a kind) is 1s, check for 5s
{
GiveActorInventory(900+current_turn,"Points",300+(50*equal_amount[4]));
ACS_Terminate(9,1);
}
else
{
GiveActorInventory(900+current_turn,"Points",100*(j+1));
ACS_Terminate(9,1);
}
}
}
}
Print(s:"Got to the end");
}