Hallo hab hier mal das erste Stadium meines Chatbots ich weiß er kann nicht viel aber ist wirklich lustig
Funktion:
Am Anfang eines Singelplayerspiels(nach 9Sekunden) bekommt man die Nachricht im Chat, dass ein Spieler gejoined ist.
2 sek nach dem joinen kann man sich primitiv mit ihm unterhalten.
Dass heißt er versteht Begrüßungen wie Hallo,hi,servus,moin und ähnliche
Desweiteren erkennt er Sätze mit Fragestellungen wie z.b. wie geht es dir oder wie geht's und antwortet auf diese.
Als nächstes soll eine Art eigeninitiative entwickelt werden die den Bot selber ein Gespräch anfäöngen lässt.
Zurzeit gibt es 6 verschiedene Begrüßungen
6 verschiedene Aussagen über den Zustand des Bots (gut,schlecht usw)
10 verschiedene Namen
Er kann Sätze bilden z.b. bei einer Kombination aus Begrüßung und Fragestellung
Natürlich ist der COde nicht so kurz wie möglich usw er soll ja auch nur dem Spaß ansich dienen
Bitte nicht flamen hatte grad kein Bock auf ein Array(kommt morgen)
nameint = math.random (0, 10)
antwort2=false
local round = function(a, prec)
return math.floor(a + 0.5*prec)
end
----|| strText == "hallo" || strText == "hi" || strText == "Hi" || strText == "moin" || strText == "Moin" || strText == "moinsen" || strText == "Moinsen" || strText == "servus"||strText == "Servus"
-----string.find( input_string , "hallo" )
Name= "ExampleName"
if(nameint==0) then
Name = "Rüdiger263"
end
if(nameint==1) then
Name = "AnimeLover69"
end
if(nameint==2) then
Name = "xXPetraSchmitzXx"
end
if(nameint==3) then
Name = "xXMinecraftHDXXLXx"
end
if(nameint==4) then
Name = "Bananaboat34"
end
if(nameint==5) then
Name = "AnimeLover69"
end
if(nameint==6) then
Name = "RüdigerBrauchtBeef"
end
if(nameint==7) then
Name = "Kevin007"
end
if(nameint==8) then
Name = "HasselbrookForEver"
end
if(nameint==9) then
Name = "F4Y_HD"
end
if(nameint==10) then
Name = "I_am_not_Schleichwerbung"
end
timer.Simple( 9, function() chat.AddText(Color(128,255,128), "Player " ,Name , " has joined the game")end)
timer.Simple( 7, function()
hook.Add( "OnPlayerChat", "cmd", function( ply, strText, bTeam, bDead )
antwort2=false
timer.Simple( 2, function()
strText = string.lower( strText )
if (ply == LocalPlayer() && string.find( strText , "hallo" )||string.find( strText , "Hallo" )||string.find( strText , "moin" )||string.find( strText , "Moin" )||string.find( strText , "hi" )||string.find( strText , "Hi" )||string.find( strText , "servus" )||string.find( strText , "servus" )) then
if(string.find( strText , "wie" )||string.find( strText , "Wie" )&&string.find( strText , "geht" ) || string.find( strText , "Geht" )) then
antwort2 = true
end
antwort1 = math.random (0, 5)
if(antwort1==0) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": hi!")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": hi",", eigentlich ganz gut!")
end
end
if(antwort1==1) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Hallo :D")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Hallo :D eigentlich kann ich mich nicht beschweren!")
end
end
if(antwort1==2) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": moin")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": moin habe grad leider ein paar kleien Probleme sonst ist aber alles gut")
end
end
if(antwort1==3) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": servus")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": servus hab gard nen pa Bretzen gegessen kann mich net beschweren gell :P")
end
end
if(antwort1==4) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Guten Tag")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Guten Tag, mir geht es gut danke der Nachfrage")
end
end
if(antwort1==5) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Auch wieder Da :D....")
end
if(antwort2==true) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Auch wieder Da :D.... Allein weil du da bist freue ich mich -.-")
end
end
return true
end
if(string.find( strText , "wie" )||string.find( strText , "Wie" )&&string.find( strText , "geht" ) || string.find( strText , "Geht" )) then
if(antwort1==5) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),":Allein weil du da bist freue ich mich -.-")
end
end
if(antwort1==4) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Mir geht es gut danke der Nachfrage")
end
end
if(antwort1==3) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Hab grad nen paar Bretzen gegessen kann mich net beschweren gell :P")
end
end
if(antwort1==2) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Habe grad leider ein paar kleien Probleme sonst ist aber alles gut")
end
end
if(antwort1==1) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": Eigentlich kann ich mich nicht beschweren!")
end
end
if(antwort1==0) then
if(antwort2==false) then
chat.AddText(Color(0,140,0),"(TEAM) ",Color(255,255,79), Name," ",Color(255,255,255),": eigentlich ganz gut!")
end
end
end
antwort2=false
end)
end)
end)
Alles anzeigen
Erklärung der Namen:
Zeile 11-41: Hier könnt ihr Fiktive Spieler Namen eintragen oder die existrierenden lassen