Simba Code:
program TriviaScript;
{$DEFINE SMART8}
{$i srl/srl.simba}
var
CorrectAnswer,isOnFire:Boolean;
Questions,tempVar,onFire:Integer;
TIA:TIntegerArray;
Names:array of String;
Points:array of Integer;
prevString:String;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Change this to add more players
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Member := True;
Active := True;
end;
{ // Remove comment and adjust numbers to add more players.
with Players[1] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Member := True;
Active := True;
end;
}
end;
procedure SetupLogin;
begin
ClearReport;
ClearDebug;
SetupSRL;
ActivateClient;
DeclarePlayers
end;
function RandomQuestion(r:Integer):String;
begin
case r of
1: Result := 'red: What is the village of NPCs called north of Falador?';
2: Result := 'red: What is the most common monster F2P players train on?';
3: Result := 'red: What is the desert F2P city called?';
4: Result := 'red: What city is the White Knights city?';
5: Result := 'red: What is the newest city added to F2P?';
6: Result := 'red: What is the Duke of Lumbridges name?';
7: Result := 'red: Who runs the Varrock Mage Shop?';
8: Result := 'red: Who is the owner of Ruin$cape?';
9: Result := 'red: What allows you to teleport everywhere without runes?';
10: Result := 'red: What is the strongest F2P monster?';
11: Result := 'red: What is the strongest F2P (non-dg) weapon?';
12: Result := 'red: What is the most expensive rare set [F2P]?';
13: Result := 'red: What are the strongest type of shields?';
14: Result := 'red: What is the city northwest of Lumbridge called?';
15: Result := 'red: Which one of these skills is P2P: Strength, Agility, Ranged?';
16: Result := 'red: Is a Dragon Crossbow p2p or f2p?';
17: Result := 'red: Which item allows you to return from a Black Hole?';
18: Result := 'red: Who is the creator of this marvelous script?';
19: Result := 'red: What level do you need to craft Nature Runes?';
20: Result := 'red: Yes/No: Can you catch Shark in f2p?';
21: Result := 'red: What does EOC stand for?';
22: Result := 'red: Yes/No: Does Port Sarim have a bank?';
23: Result := 'red: What transportation system used to be p2p?';
24: Result := 'red: Which city was the air altar located next to before Varrock?';
25: Result := 'red: Where is the closest anvil to a bank?';
26: Result := 'red: Yes/No: The symbol for a fountain is a water drop?';
27: Result := 'red: Yes/No: Crandor is the name of the island in Dragon Slayer?';
end;
end;
function AnswerQ(r:Integer):String;
begin
case r of
1: Result := 'Goblin village';
2: Result := 'Hill giants';
3: Result := 'Al kharid';
4: Result := 'Falador';
5: Result := 'Burthorpe';
6: Result := 'Horacio';
7: Result := 'Aubury';
8: Result := 'Jagex';
9: Result := 'Lodestones';
10: Result := 'Elvarg';
11: Result := 'Rune 2h';
12: Result := 'Partyhats';
13: Result := 'Kiteshields';
14: Result := 'Draynor';
15: Result := 'Agility';
16: Result := 'P2p';
17: Result := 'Diskofreturning';
18: Result := 'Sin';
19: Result := '44';
20: Result := 'No';
21: Result := 'Evolution ofCombat';
22: Result := 'No';
23: Result := 'Canoe';
24: Result := 'Falador';
25: Result := 'Varrock';
26: Result := 'Yes';
27: Result := 'Yes';
end;
end;
procedure CGTWinner(arrayIndex:Integer);
begin
TypeSend(Names[arrayIndex] + ' is in the lead at the moment with ' + ToStr(Points[arrayIndex]) + ' point(s)!');
end;
procedure AddNamePoint(Name:String);
var
i:Integer;
begin
//Set array length to match Names
SetLength(Points,Length(Names));
//initializing vars
Names[0] := 'Default';
Points[0] := 0;
for i := 1 to High(Names) do
begin
if (Names[i] = Name) then
begin
Points[i] := Points[i] + 1;
writeLn('One point added to ' + ToStr(Names[i]));
Exit;
end;
end;
writeLn('Name didnt exist in array, adding now.');
//incase index[i] doesnt exist
i := Length(Names);
SetLength(Names,i+1);
Names[Length(Names)-1] := Name;
AddNamePoint(Name);
end;
function GetMaxArrayValue(a:TIntegerArray; var arrayIndex:Integer):Integer;
var
j,bigInt,tempInt,arrayVal:Integer ;
begin
bigInt := 0;
for j := 1 to High(a) do
begin
tempInt := a[j];
if (tempInt > bigInt) then
begin
bigInt := a[j];
arrayVal := j;
end;
end;
Result := bigInt;
arrayIndex := arrayVal;
end;
function GetAnswerFromName(r:Integer):String;
var
i,maxArr,arrIndex:Integer;
TSA:array of String;
tempString:String;
begin
isOnFire := false;
SetLength(TSA,9);
TSA[0] := '';
for i := 1 to 8 do
begin
tempString := GetChatBoxText(i,clBlack);
TSA[i] := GetChatBoxText(i,clBlue);
writeLn('In index ' + ToStr(i)+ ' ' + TSA[i]);
if (lowercase(TSA[i]) = lowercase(AnswerQ(r))) then
begin
Result := tempString;
writeLn('Correct Answer: ' + tempString);
if (prevString = tempString) then
begin
Inc(onFire);
isOnFire := True;
if (onFire = 5) then
begin
TypeSend(tempString + ' has gotten 5 in a row! ' + tempString + ' is on fire!');
onFire := 0;
end;
end;
CorrectAnswer := True;
TypeSend('flash2: ' + tempString + ' got the correct answer!');
AddNamePoint(tempString);
prevString := tempString;
maxArr := GetMaxArrayValue(Points,arrIndex);
CGTWinner(arrIndex);
if (not isOnFire) then
isOnFire := False;
Wait(2000);
Break;
end;
end;
end;
function HintAnswer(number,r:Integer):String;
begin
case number of
1:
case r of
1: Result := 'The NPCs are mean and green!';
2: Result := 'They are level 28 (before EOC)!';
3: Result := 'It sounds arabic!';
4: Result := 'Dont ``fall`` over thinking about it!';
5: Result := 'Its near Taverly!';
6: Result := 'It starts with a H!';
7: Result := 'Starts with an A';
8: Result := 'Starts with J';
9: Result := 'L_________';
10: Result := 'Its a dragon!';
11: Result := 'You hold it with 2 hands!';
12: Result := 'A nice hat from a cracker!';
13: Result := 'This is getting me as high as a Kite!';
14: Result := 'Vampires and Potatoes!';
15: Result := 'No hint.';
16: Result := 'No hint.';
17: Result := 'Disks';
18: Result := 'No hint.';
19: Result := 'No hint.';
20: Result := 'No hint.';
21: Result := 'No hint.';
22: Result := 'No hint.';
23: Result := 'It is not a teleport';
24: Result := 'There is a tree standing where the altar used to be';
25: Result := 'It is in a big city';
26, 27: Result := 'No hint.';
end;
2:
case r of
1: Result := 'Populated by General Bentnoze and Wartface!';
2: Result := 'These things are giant!';
3: Result := 'Filled with snake charmers!';
4: Result := 'Sir Tiffy would know what im talking about!';
5: Result := 'It starts with a B!';
6: Result := 'Hes on the second floor of the castle!';
7: Result := 'Surprised his hair isnt.. AUBURN..';
8: Result := 'No hint. Too Easy';
9: Result := 'LODE...';
10: Result := 'Starts with an E!';
11: Result := 'Its made of Rune!';
12: Result := 'Lets party!';
13: Result := 'Kite + Shield = profit!';
14: Result := 'Tons of botters here!';
15: Result := 'No hint.';
16: Result := 'No hint.';
17: Result := 'Might as well come back!';
18: Result := 'No hint.';
19: Result := 'No hint.';
20: Result := 'No hint.';
21: Result := 'No hint.';
22: Result := 'No hint.';
23: Result := 'It requires a woodcutting level to use';
24: Result := 'There are imps nearby';
25: Result := 'It is not near a mine or a furnace';
26, 27: Result := 'No hint.';
end;
3:
case r of
1: Result := 'Its G_____ v______!';
2: Result := 'They live on hills!';
3: Result := 'Its close to Lumbridge!';
4: Result := 'F___d__';
5: Result := 'B________';
6: Result := 'H___c__';
7: Result := 'A_____';
8: Result := 'No hint. Too Easy';
9: Result := 'Cool stones!';
10: Result := 'From the dragon slayer quest!';
11: Result := 'R___ 2_';
12: Result := 'Partying with my hat on!';
13: Result := 'K_________s';
14: Result := 'D______';
15: Result := 'No hint.';
16: Result := 'No hint.';
17: Result := 'D___ o_ R________';
18: Result := 'No hint.';
19: Result := 'No hint.';
20: Result := 'No hint.';
21: Result := 'No hint.';
22: Result := 'No hint.';
23: Result := 'It can take you to the wilderness';
24: Result := 'You can get killed by highwaymen there';
25: Result := 'It has ruins nearby';
26, 27: Result := 'No hint.';
end;
end;
end;
procedure AskQuestion;
var
s,ans:String;
r,t,i,j:Integer;
HintAns:TStringArray;
begin
r := RandomRange(1,27);
for j := 1 to 27 do
begin
if TIA[j] = r then
exit;
end;
TIA[r] := r;
s := RandomQuestion(r);
Inc(Questions);
writeLn(s);
TypeSend(s);
//SendKeys(s,1,1);
Wait(500);
TypeByte(VK_ENTER);
MarkTime(t);
SetLength(HintAns,4);
HintAns[0] := '';
repeat
if ((TimeFromMark(t) > (5000)) and (i=0)) then
begin
Inc(i);
HintAns[i] := HintAnswer(1,r);
TypeSend('flash2: Hint #1: ' + HintAns[i]);
end;
if ((TimeFromMark(t) > (25000)) and (i=1)) then
begin
Inc(i);
HintAns[i] := HintAnswer(2,r);
TypeSend('flash2: Hint #2: ' + HintAns[i]);
end;
if ((TimeFromMark(t) > (45000)) and (i=2)) then
begin
Inc(i);
HintAns[i] := HintAnswer(3,r);
TypeSend('flash2: Hint #3: ' + HintAns[i]);
end;
if ((TimeFromMark(t) > 60000) and (i = 3)) then
begin
TypeSend('Aw. Nobody got it! The correct answer was: ' + AnswerQ(r));
break;
end;
ans := GetAnswerFromName(r);
until (CorrectAnswer);
if (Questions = 5) then
begin
Questions := 0;
TypeSend('This trivia game brought to you by Sin!');
Wait(3000);
end;
CorrectAnswer := False;
tempVar := r;
end;
begin
SetupLogin;
SetLength(TIA,29);
SetLength(Names,2);
TIA[0] := 0;
TypeSend('flash1: ~~~Welcome to Trivia! Please answer with correct spelling!~~~');
//TypeSend('flash2: The point system/onFire system is in beta, please dont yell at me for bugs :(');
Wait(3000);
repeat
AskQuestion;
until not LoggedIn;
end.
Quote:
1: Result := 'red: What is the village of NPCs called north of Falador?';
2: Result := 'red: What is the most common monster F2P players train on?';
3: Result := 'red: What is the desert F2P city called?';
4: Result := 'red: What city is the White Knights city?';
5: Result := 'red: What is the newest city added to F2P?';
6: Result := 'red: What is the Duke of Lumbridges name?';
7: Result := 'red: Who runs the Varrock Mage Shop?';
8: Result := 'red: Who is the owner of Ruin$cape?';
9: Result := 'red: What allows you to teleport everywhere without runes?';
10: Result := 'red: What is the strongest F2P monster?';
11: Result := 'red: What is the strongest F2P (non-dg) weapon?';
12: Result := 'red: What is the most expensive rare set [F2P]?';
13: Result := 'red: What are the strongest type of shields?';
14: Result := 'red: What is the city northwest of Lumbridge called?';
15: Result := 'red: Which one of these skills is P2P: Strength, Agility, Ranged?';
16: Result := 'red: Is a Dragon Crossbow p2p or f2p?';
17: Result := 'red: Which item allows you to return from a Black Hole?';
18: Result := 'red: Who is the creator of this marvelous script?';
19: Result := 'red: What level do you need to craft Nature Runes?';
20: Result := 'red: Yes/No: Can you catch Shark in f2p?';
21: Result := 'red: What does EOC stand for?';
22: Result := 'red: Yes/No: Does Port Sarim have a bank?';
23: Result := 'red: What transportation system used to be p2p?';
24: Result := 'red: Which city was the air altar located next to before Varrock?';
25: Result := 'red: Where is the closest anvil to a bank?';
26: Result := 'red: Yes/No: The symbol for a fountain is a water drop?';
27: Result := 'red: Yes/No: Crandor is the name of the island in Dragon Slayer?';
Post and i'll add them into here.