Here are my scripts:
OnUserDefined:
void main()
{
object oSelf = OBJECT_SELF;
object oPC = GetFirstPC();
int iPattern = GetListenPatternNumber();
int iQuest = GetLocalInt(oPC, "iQvar");
int iQnum = GetLocalInt(oPC, "iQuestion");
if(GetIsListening(oSelf))
{
if((iPattern == 517) && (iQuest == 2) && (iQnum == 17))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3a : 17.24 X 30 **");
PrintString("** Answer 3a : 517.2 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 18);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 518) && (iQuest == 2) && (iQnum == 18))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3b : 2.735 X 40 **");
PrintString("** Answer 3b : 109.4 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 19);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 519) && (iQuest == 2) && (iQnum == 19))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3c : 14.45 X 50 **");
PrintString("** Answer 3c : 722.5 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 20);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 520) && (iQuest == 2) && (iQnum == 20))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3d : 3.127 X 30 **");
PrintString("** Answer 3d : 93.81 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 21);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 521) && (iQuest == 2) && (iQnum == 21))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3e : 0.6 ÷ 20 **");
PrintString("** Answer 3e : 0.03 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 22);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 522) && (iQuest == 2) && (iQnum == 22))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3f : 0.4 ÷ 80 **");
PrintString("** Answer 3f : 0.005 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 23);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 523) && (iQuest == 2) && (iQnum == 23))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3g : 0.4 ÷ 60 **");
PrintString("** Answer 3g : 0.006 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 24);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 524) && (iQuest == 2) && (iQnum == 24))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3h : 0.8 ÷ 50 **");
PrintString("** Answer 3h : 0.016 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 25);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 525) && (iQuest == 2) && (iQnum == 25))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3i : 14 ÷ 0.2 **");
PrintString("** Answer 3i : 70 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 26);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 526) && (iQuest == 2) && (iQnum == 26))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3j : 35 ÷ 0.5 **");
PrintString("** Answer 3j : 70 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 27);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 527) && (iQuest == 2) && (iQnum == 27))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3k : 27 ÷ 0.3 **");
PrintString("** Answer 3k : 90 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 28);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if((iPattern == 528) && (iQuest == 2) && (iQnum == 28))
{
SpeakString(" Well done ");
ClearAllActions();
PrintString("** **");
WriteTimestampedLogEntry("** Time **");
PrintString("** Question 3l : 24 ÷ 0.4 **");
PrintString("** Answer 3l : 60 **");
PrintString("** **");
SetLocalInt(oPC, "iQuestion", 29);
SetLocalInt(oPC, "iQvar", 3);
SetListening(oSelf, FALSE);
GiveGoldToCreature(oPC, 30);
AssignCommand(oSelf, ActionStartConversation(oPC, "con_drow_qset2"));
}
if(iPattern == 999)
{
SpeakString(" Sorry, that's not the correct answer. Try again. ");
TakeGoldFromCreature(30, oPC, TRUE);
}
}
}
Script placed in conversation actions taken when I want PC to answer
void main()
{
object oSelf = OBJECT_SELF;
object oPC = GetFirstPC();
// Decimals
string sAnswer3a = "517.2";
string sAnswer3b = "109.4";
string sAnswer3c = "722.5";
string sAnswer3d = "93.81";
string sAnswer3e = "0.03";
string sAnswer3f = "0.005";
string sAnswer3g = "0.006";
string sAnswer3h = "0.016";
string sAnswer3i = "70";
string sAnswer3j = "70";
string sAnswer3k = "90";
string sAnswer3l = "60";
SetListenPattern(oSelf, sAnswer3a, 517);
SetListenPattern(oSelf, sAnswer3b, 518);
SetListenPattern(oSelf, sAnswer3c, 519);
SetListenPattern(oSelf, sAnswer3d, 520);
SetListenPattern(oSelf, sAnswer3e, 521);
SetListenPattern(oSelf, sAnswer3f, 522);
SetListenPattern(oSelf, sAnswer3g, 523);
SetListenPattern(oSelf, sAnswer3h, 524);
SetListenPattern(oSelf, sAnswer3i, 525);
SetListenPattern(oSelf, sAnswer3j, 526);
SetListenPattern(oSelf, sAnswer3k, 527);
SetListenPattern(oSelf, sAnswer3l, 528);
SetListenPattern(oSelf, "**", 999);
SetListening(oSelf, TRUE);
}