24.06.2004, 18:02 Uhr
Also ich hab mir das Botquiz hier installiert.. läuft auch super, bis auf ein Problem. Wenn ich !quizantwort schreibe, macht der nicht weiter, sondern wartet bis einer von usn die antwort wiederholt. natürlich bekommt derjenige dann auch nen punkt.
hab das script ma hier reinkopiert. hoffe war nicht schlimm.
also kann man einen befehl einbauen dass er automatisch zur nächsten frage springt wenn er die antwort gesagt hat?
sage schon ma danke
'| BotQuiz V1.0 by Stefan Grünauer
'| Dieses Script startet mit !startquiz #channel ein Quiz im angegebenen Channel
'| mit !stopquiz beendet er das Quiz und zeigt die Auswertung.
'| Der Bot muss aber auch in dem Channel anwesend sein!
public quizstart
einleitung = "Willkommen beim BotQuiz 1.0"
ausleitung = "Das war's mit dem BotQuiz 1.0! Bis zum nächsten mal!"
startfrage = "Wir suchen jetzt: ;Die Frage lautet: ;Was ist: "
startloesung = "Die Lösung war: ;Richtig ist: ;Gesucht wurde: "
startcorrect = "Das war richtig ;Korrekt Alter, ;Du hast es gefunden "
quizantwort = ""
quizhilfe = ""
quizchan = ""
quizcount = 0
datenfile = "filearea\scripts\botquiz.txt"
dim quest() : redim quest(0)
sub init()
scriptname = "BotQuiz V1.0 by Stefan Gruenauer"
script scriptname
hook "chan_msg"
randomize time
SpreadFlagMessage 0, "+m", "14*** " & scriptname & " loaded."
end sub
Sub Chan_msg(Chan, Nick, RegUser, Line)
If param(lcase(Line),1) = "!quizantwort" then
For i = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), i, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), i, CU_Nick) = nick then
sendline "PRIVMSG " & quizchan & " :0,1Die Antwort müsste sein:" & quizantwort, 3
end if
end if
Next
end if
'Startet das Quiz wenn noch keines läuft
If param(lcase(Line),1) = "!startquiz" then
For i = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), i, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), i, CU_Nick) = nick then
if quizchan = "" then
if param(lcase(line),2) <> "" then
TimedCommand "doquiz(""" & param(lcase(line),2) & """)", 1
quizchan = param(lcase(line),2)
else
sendline "PRIVMSG " & nick & " :0,1Du musst noch den Channel angeben z.B. !startquiz #2hot4u", 3
end if
else
sendline "PRIVMSG " & nick & " :0,1Sorry, aber es läuft bereits ein Quiz in " & quizchan & "!", 3
end if
end if
end if
Next
End if
'Stoppt das Quiz und zeigt eine Auswertung
If param(lcase(Line),1) = "!stopquiz" then
For z = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), z, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), z, CU_Nick) = nick then
if quizchan <> "" then
quizplayer = readinistring(date, "quizplayers", "", "botquiz.ini")
if quizplayer <> "" then
quizplayers = split(quizplayer,";")
sendline "PRIVMSG " & quizchan & " :0,1Das Quiz wurde beendet. Hier nun die Auswertung:", 3
sendline "PRIVMSG " & quizchan & " :0,1Es wurden " & quizcount & " Fragen gestellt.", 3
winnerpoint = 0
winnername = ""
for i = 0 to ubound(quizplayers)
playercount = readinistring(date, quizplayers(i), "", "botquiz.ini")
writeinistring date, quizplayers(i), "", "botquiz.ini"
if playercount <> "" then
sendline "PRIVMSG " & quizchan & " :4,1" & quizplayers(i) & "0,1 hat4,1 " & playercount & "0,1 Punkte", 3
if playercount > winnerpoint then
winnerpoint = playercount
winnername = quizplayers(i)
else
if playercount = winnerpoint then
winnerpoint = playercount
winnername = winnername & " und " & quizplayers(i)
end if
end if
end if
next
writeinistring date, "quizplayers", "", "botquiz.ini"
sendline "PRIVMSG " & quizchan & " :0,1Somit gewinnt4,1 " & winnername & " 0,1mit4,1 " & winnerpoint & " 0,1Punkten das Quiz!", 3
sendline "PRIVMSG " & quizchan & " :0,1" & ausleitung, 3
quizchan = ""
quizantwort = ""
quizcount = 0
else
sendline "PRIVMSG " & quizchan & " :0,1Sorry, aber es hat leider keiner mitgemacht beim Quiz!", 3
quizchan = ""
quizantwort = ""
quizcount = 0
end if
else
sendline "PRIVMSG " & nick & " :0,1Sorry, aber es läuft momentan kein Quiz!", 3
end if
end if
end if
Next
end if
'Gibt Hilfestellung
if param(lcase(line),1) = "!tip" then
if quizchan <> "" and quizantwort <> "" then
textout = split(quizhilfe, "|")
sendline "PRIVMSG " & quizchan & " :0,1Hier eine kleine Hilfestellung:4,1 " & textout(int(rnd*ubound(textout))+1), 3
end if
end if
'Überprüfung der Lösung
if quizantwort <> "" then
if lcase(quizchan) = lcase(chan) then
If InStr(lcase(Line), quizantwort) > 0 Then
Gebraucht = datediff("s",quizstart,Time)
If Gebraucht > 60 Then
Gebraucht = int(Gebraucht / 60) & " Minuten " & gebraucht - int(gebraucht / 60) * 60 & " Sekunden"
Else
Gebraucht = Gebraucht & " Sekunden"
End If
textout = split(startcorrect, ";")
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & nick, 3
textout = split(startloesung, ";")
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & quizantwort & "0,1 - gefunden in " & gebraucht, 3
'Punkte vergeben
playercount = readinistring(date, nick, "", "botquiz.ini")
if playercount <> "" then
writeinistring date, nick, int(playercount) + 1, "botquiz.ini"
playercount = playercount + 1
else
quizplayers = readinistring(date, "quizplayers", "", "botquiz.ini")
if quizplayers <> "" then
writeinistring date, "quizplayers", quizplayers & ";" & nick, "botquiz.ini"
else
writeinistring date, "quizplayers", nick, "botquiz.ini"
end if
writeinistring date, nick, "1", "botquiz.ini"
playercount = 1
end if
sendline "PRIVMSG " & quizchan & " :0,1" & nick & " hat jetzt4,1 " & playercount & "0,1 Punkte gesammelt.", 3
quizantwort = ""
TimedCommand "doquiz(""" & quizchan & """)", 10
end if
end if
end if
End sub
sub doquiz(quizchan)
fragenfile = fileopen(datenfile,fa_read)
while not fileeof(fragenfile)
redim preserve quest(ubound(quest)+1)
quest(ubound(quest))=filereadln(fragenfile)
wend
fileclose fragenfile
fragentext = quest(int(rnd*ubound(quest))+1)
if fragentext <> "" then
fragentext = split(fragentext, "¦")
quizfrage = fragentext(0)
quizantwort = lcase(fragentext(1))
quizhilfe = fragentext(2)
quizcount = quizcount + 1
if quizcount = 1 then
sendline "PRIVMSG " & quizchan & " :0,1" & einleitung, 3
end if
textout = split(startfrage, ";")
quizstart = time
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & quizfrage, 3
end if
end sub
hab das script ma hier reinkopiert. hoffe war nicht schlimm.
also kann man einen befehl einbauen dass er automatisch zur nächsten frage springt wenn er die antwort gesagt hat?
sage schon ma danke

'| BotQuiz V1.0 by Stefan Grünauer
'| Dieses Script startet mit !startquiz #channel ein Quiz im angegebenen Channel
'| mit !stopquiz beendet er das Quiz und zeigt die Auswertung.
'| Der Bot muss aber auch in dem Channel anwesend sein!
public quizstart
einleitung = "Willkommen beim BotQuiz 1.0"
ausleitung = "Das war's mit dem BotQuiz 1.0! Bis zum nächsten mal!"
startfrage = "Wir suchen jetzt: ;Die Frage lautet: ;Was ist: "
startloesung = "Die Lösung war: ;Richtig ist: ;Gesucht wurde: "
startcorrect = "Das war richtig ;Korrekt Alter, ;Du hast es gefunden "
quizantwort = ""
quizhilfe = ""
quizchan = ""
quizcount = 0
datenfile = "filearea\scripts\botquiz.txt"
dim quest() : redim quest(0)
sub init()
scriptname = "BotQuiz V1.0 by Stefan Gruenauer"
script scriptname
hook "chan_msg"
randomize time
SpreadFlagMessage 0, "+m", "14*** " & scriptname & " loaded."
end sub
Sub Chan_msg(Chan, Nick, RegUser, Line)
If param(lcase(Line),1) = "!quizantwort" then
For i = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), i, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), i, CU_Nick) = nick then
sendline "PRIVMSG " & quizchan & " :0,1Die Antwort müsste sein:" & quizantwort, 3
end if
end if
Next
end if
'Startet das Quiz wenn noch keines läuft
If param(lcase(Line),1) = "!startquiz" then
For i = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), i, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), i, CU_Nick) = nick then
if quizchan = "" then
if param(lcase(line),2) <> "" then
TimedCommand "doquiz(""" & param(lcase(line),2) & """)", 1
quizchan = param(lcase(line),2)
else
sendline "PRIVMSG " & nick & " :0,1Du musst noch den Channel angeben z.B. !startquiz #2hot4u", 3
end if
else
sendline "PRIVMSG " & nick & " :0,1Sorry, aber es läuft bereits ein Quiz in " & quizchan & "!", 3
end if
end if
end if
Next
End if
'Stoppt das Quiz und zeigt eine Auswertung
If param(lcase(Line),1) = "!stopquiz" then
For z = 1 To ChanUserCount(ChanNum(Chan))
If IsOp(ChanUser(ChanNum(Chan), z, CU_Nick), Chan) Then
if ChanUser(ChanNum(Chan), z, CU_Nick) = nick then
if quizchan <> "" then
quizplayer = readinistring(date, "quizplayers", "", "botquiz.ini")
if quizplayer <> "" then
quizplayers = split(quizplayer,";")
sendline "PRIVMSG " & quizchan & " :0,1Das Quiz wurde beendet. Hier nun die Auswertung:", 3
sendline "PRIVMSG " & quizchan & " :0,1Es wurden " & quizcount & " Fragen gestellt.", 3
winnerpoint = 0
winnername = ""
for i = 0 to ubound(quizplayers)
playercount = readinistring(date, quizplayers(i), "", "botquiz.ini")
writeinistring date, quizplayers(i), "", "botquiz.ini"
if playercount <> "" then
sendline "PRIVMSG " & quizchan & " :4,1" & quizplayers(i) & "0,1 hat4,1 " & playercount & "0,1 Punkte", 3
if playercount > winnerpoint then
winnerpoint = playercount
winnername = quizplayers(i)
else
if playercount = winnerpoint then
winnerpoint = playercount
winnername = winnername & " und " & quizplayers(i)
end if
end if
end if
next
writeinistring date, "quizplayers", "", "botquiz.ini"
sendline "PRIVMSG " & quizchan & " :0,1Somit gewinnt4,1 " & winnername & " 0,1mit4,1 " & winnerpoint & " 0,1Punkten das Quiz!", 3
sendline "PRIVMSG " & quizchan & " :0,1" & ausleitung, 3
quizchan = ""
quizantwort = ""
quizcount = 0
else
sendline "PRIVMSG " & quizchan & " :0,1Sorry, aber es hat leider keiner mitgemacht beim Quiz!", 3
quizchan = ""
quizantwort = ""
quizcount = 0
end if
else
sendline "PRIVMSG " & nick & " :0,1Sorry, aber es läuft momentan kein Quiz!", 3
end if
end if
end if
Next
end if
'Gibt Hilfestellung
if param(lcase(line),1) = "!tip" then
if quizchan <> "" and quizantwort <> "" then
textout = split(quizhilfe, "|")
sendline "PRIVMSG " & quizchan & " :0,1Hier eine kleine Hilfestellung:4,1 " & textout(int(rnd*ubound(textout))+1), 3
end if
end if
'Überprüfung der Lösung
if quizantwort <> "" then
if lcase(quizchan) = lcase(chan) then
If InStr(lcase(Line), quizantwort) > 0 Then
Gebraucht = datediff("s",quizstart,Time)
If Gebraucht > 60 Then
Gebraucht = int(Gebraucht / 60) & " Minuten " & gebraucht - int(gebraucht / 60) * 60 & " Sekunden"
Else
Gebraucht = Gebraucht & " Sekunden"
End If
textout = split(startcorrect, ";")
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & nick, 3
textout = split(startloesung, ";")
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & quizantwort & "0,1 - gefunden in " & gebraucht, 3
'Punkte vergeben
playercount = readinistring(date, nick, "", "botquiz.ini")
if playercount <> "" then
writeinistring date, nick, int(playercount) + 1, "botquiz.ini"
playercount = playercount + 1
else
quizplayers = readinistring(date, "quizplayers", "", "botquiz.ini")
if quizplayers <> "" then
writeinistring date, "quizplayers", quizplayers & ";" & nick, "botquiz.ini"
else
writeinistring date, "quizplayers", nick, "botquiz.ini"
end if
writeinistring date, nick, "1", "botquiz.ini"
playercount = 1
end if
sendline "PRIVMSG " & quizchan & " :0,1" & nick & " hat jetzt4,1 " & playercount & "0,1 Punkte gesammelt.", 3
quizantwort = ""
TimedCommand "doquiz(""" & quizchan & """)", 10
end if
end if
end if
End sub
sub doquiz(quizchan)
fragenfile = fileopen(datenfile,fa_read)
while not fileeof(fragenfile)
redim preserve quest(ubound(quest)+1)
quest(ubound(quest))=filereadln(fragenfile)
wend
fileclose fragenfile
fragentext = quest(int(rnd*ubound(quest))+1)
if fragentext <> "" then
fragentext = split(fragentext, "¦")
quizfrage = fragentext(0)
quizantwort = lcase(fragentext(1))
quizhilfe = fragentext(2)
quizcount = quizcount + 1
if quizcount = 1 then
sendline "PRIVMSG " & quizchan & " :0,1" & einleitung, 3
end if
textout = split(startfrage, ";")
quizstart = time
sendline "PRIVMSG " & quizchan & " :0,1" & textout(int(rnd*ubound(textout))+1) & "4,1 " & quizfrage, 3
end if
end sub