24.02.2005, 03:04 Uhr
Da viele bestimmt das Topic Script haben hab ich nun amir sein Fehler entdeckt und gefixed.
Es esteht ein Fehler sobald man z.b. ".t~update hp http://www.angelbot-portal.de"
Obwohl man vorher
.t~set Welcome² [ %chan% ] Homepage [ %hp% ] News [ %news% ]
gemacht hat
Es fehlen 2 "" und die sin un da und es läuft direkt wunderbar ohne Fehler...
Und hier nun das ganze Script nocheinmal mit den ""
Es esteht ein Fehler sobald man z.b. ".t~update hp http://www.angelbot-portal.de"
Obwohl man vorher
.t~set Welcome² [ %chan% ] Homepage [ %hp% ] News [ %news% ]
gemacht hat
Code:
(02:59:37) (Boss) *** Scripting error in 'topic.asc':
(02:59:37) (Boss) Error : 13 (Typen unverträglich: '[string: ""]')
(02:59:37) (Boss) Position: Line 174, Column 4
(02:59:37) (Boss) Excerpt : If ReadINIString(Chan, "Update", "", tINI) = 1 Then
(02:59:37) (Boss) Command : Chan_msg "#MyBoS", "[BoS]Spike", "Spike", ".t~update hp www.mybos.de"
(02:59:37) (Boss) *** End of error messageEs fehlen 2 "" und die sin un da und es läuft direkt wunderbar ohne Fehler...
Code:
If ReadINIString(Chan, "Update", "", tINI) = "1" ThenUnd hier nun das ganze Script nocheinmal mit den ""
Code:
'***Individual-Section-Topic-Script by amir***
'
' » Channel-Commands:
' » .t~set <topic with %sections%>
' » Setzt ein Topic, alles zwischen zwei % wird zu einer Section!
' » .t~update [<section> <content>]
' » Aktualisiert eine Section mit angegebenem Inhalt
' » Wird keine Section angegeben, liest er erneut alles aus und aktualisiert das Topic
' » .t~sections
' » Zeigt alle vorhandenen Sections an
' » .t~cfg <lock/update/set> <1/0>
' » .t~cfg lock <1/0>
' » (Ent)Lockt das Topic. Ist das Topic gelockt, so kann das Topic nur vom Bot geändert werden.
' » Wird das Topic dennoch geändert, ändert der Bot es zurück (Q ausgenommen)
' » .t~cfg update <1/0>
' » Legt fest ob das Topic beim Update einer Section mitgeändert werden soll oder nicht.
' » Bei 0 wird das Topic erst via ".t~update" aktualisiert
' » .t~cfg set <1/0>
' » Legt fest ob das Topic beim Topic update gesetzt werden soll [-> mit leeren %sections%]
' » Bei 0 wird das Topic erst via ".t~update" aktualisiert
' » Query-Commands
' » Benutzung der Commands wie im Channel, es muss aber als zweiter Paragraph der Channel angegeben werden!
' » .t~<set/update/sections/cfg> <#chan> [<topic>/<section> <content>/<lock/update/set>] [<1/0>]
'
'***/Individual-Section-Topic-Script by amir***
Const tINI = "topic.ini"
Sub Init()
Script "Topicscript V1.0d by amir"
Hook "Chan_Msg"
Hook "Priv_Msg"
Hook "Topic"
End Sub
Dim cTopic, cSec, sectionCount, sectionContent, Lines
Sub Chan_Msg(Chan, Nick, RegUser, Line)
If Left(LCase(Param(Line, 1)), 3) = ".t~" Then
If MatchFlags(GetUserChanFlags(RegUser, Chan), "+m") Then
Select Case Mid(LCase(Param(Line, 1)), 4)
Case "set"
If Param(Line, 2) <> "" Then
sectionCount = 0
WriteINIString Chan, "Topic", GetRest(Line,2), tINI
If ReadINIString(Chan, "tSections", "", tINI) <> "" Then
For i = 0 To ReadINIString(Chan, "tSections", "", tINI)
DeleteINIString Chan, ReadINIString(Chan, "tSection" & i, "", tINI), tINI
DeleteINIString Chan, "tSection" & i, tINI
Next
End If
For i = 1 To ParamCount(Line)
If Left(Param(Line, i), 1) = "%" And Right(Param(Line, i), 1) = "%" Then
WriteINIString Chan, "tSection" & sectionCount, Mid(Param(Line, i), 2, Len(Param(Line, i)) - 2), tINI
WriteINIString Chan, "tSections", sectionCount, tINI
sectionCount = sectionCount + 1
ElseIf Instr(1, Param(Line, i), "%") > 0 Then
WriteINIString Chan, "tSection" & sectionCount, Mid(Param(Line, i), Instr(1, Param(Line, i), "%") + 1, Instr(Instr(1, Param(Line, i), "%") + 1, Param(Line, i), "%") - (Instr(1, Param(Line, i), "%") + 1)), tINI
WriteINIString Chan, "tSections", sectionCount, tINI
sectionCount = sectionCount + 1
End If
Next
If ReadINIString(Chan, "Set", "", tINI) = vbNullString Then WriteINIString Chan, "Set", "0", tINI
If ReadINIString(Chan, "Set", "", tINI) = "1" Then
SendLine "TOPIC " & Chan & " :" & GetRest(Line,2), 2
Else
SendLine "Notice " & Nick & " :Saved topic to: " & GetRest(Line,2), 2
End If
Else
Sendline "Notice " & Nick & " :.t~set <new topic with %sections%>", 2
End If
Case "update"
If Instr(1, Line, ":AND:") => 1 Then
Lines = Split(GetRest(Line,2), ":AND:")
For i = LBound(Lines) To UBound(Lines)
UpdateTopic Chan, Nick, ".t~update " & LTrim(Lines(i))
Next
Else
UpdateTopic Chan, Nick, Line
End If
Case "sections"
sections = ""
sCount = ReadINIString(Chan, "tSections", "", tINI)
If sCount = vbNullString Then
Sendline "Notice " & Nick & " :There are no sections. Create them by setting a new topic with %sections%", 2
Exit Sub
End If
For i = 0 To sCount
cSec = ReadINIString(Chan, "tSection" & i, "", tINI)
sections = sections & " ¬ " & cSec & ""
Next
Sendline "Notice " & Nick & " :Topicsections: " & sections & " ¬ ", 2
Case "cfg"
Select Case LCase(Param(Line,2))
Case "update"
Select Case LCase(Param(Line,3))
Case "0", "no", "off"
Sendline "Notice " & Nick & " :I won't change the topic now when typing .t~update <section>. Use .t~update to update the whole topic.",2
WriteINIString Chan, "Update", "0", tINI
Case "1", "yes", "on"
Sendline "Notice " & Nick & " :Now updating topic for each section!",2
WriteINIString Chan, "Update", "1", tINI
Case ""
Sendline "Notice " & Nick & " :.t~cfg update <1/0>",2
End Select
Case "lock"
Select Case LCase(Param(Line,3))
Case "on", "1", "no"
WriteINIString Chan, "LockTopic", "1", tINI
Sendline "Notice " & Nick & " :Topic is now locked! You have to use ME in order to change the topic!",2
Case "off", "0", "yes"
WriteINIString Chan, "LockTopic", "0", tINI
Sendline "Notice " & Nick & " :Topic is no longer locked!",2
Case ""
Sendline "Notice " & Nick & " :.t~cfg lock <1/0>",2
End Select
Case "set"
Select Case LCase(Param(Line,3))
Case "0", "yes"
Sendline "Notice " & Nick & " :I won't change the topic now when typing .t~set <topic>. Use .t~update to update the topic.",2
WriteINIString Chan, "Set", "0", tINI
Case "1", "no"
Sendline "Notice " & Nick & " :Now updating topic when using .t~set <topic>!",2
WriteINIString Chan, "Set", "1", tINI
Case ""
Sendline "Notice " & Nick & " :.t~cfg set <1/0>",2
End Select
End Select
End Select
End If
End If
End Sub
Sub Priv_Msg(Nick, RegUser, Line)
If Left(Param(Line,2), "1") = "#" And Left(LCase(Param(Line, 1)), 3) = ".t~" And IsOn(MyNick, Param(Line,2)) Then
Chan_Msg Param(Line,2), Nick, RegUser, (Param(Line,1) & " " & GetRest(Line,3))
ElseIf Left(LCase(Param(Line, 1)), 3) = ".t~" And ParamCount(Line) < 2 Then
Sendline "Privmsg " & Nick & " :.t~set #chan <topic w/ %sections%> ¬ .t~update #chan [<section> <content>] ¬ .t~sections #chan", 2
ElseIf Left(Param(Line,2), "1") = "#" And Left(LCase(Param(Line, 1)), 3) = ".t~" And Not IsOn(MyNick, Param(Line,2)) Then
Sendline "Privmsg " & Nick & " :I'm not on that channel.", 2
End If
End Sub
Sub Topic(Chan, Nick, RegUser, Flags, Line)
If Nick = MyNick Or Len(Nick) = 1 Then Exit Sub
If Readinistring(Chan, "LockTopic", "", tINI) = "1" Then
cTopic = ReadINIString(Chan, "Topic", "", tINI)
For j = 0 To ReadINIString(Chan, "tSections", "", tINI)
cSec = ReadINIString(Chan, "tSection" & j, "", tINI)
secContent = Readinistring(Chan, cSec, "", tINI)
If secContent <> "" Then
cTopic = Replace(cTopic, "%" & cSec & "%", secContent)
End If
Next
SendLine "TOPIC " & Chan & " :" & cTopic, 2
End If
End Sub
Sub UpdateTopic(Chan, Nick, Line)
If ParamCount(Line) > 2 Then
For i = 0 To ReadINIString(Chan, "tSections", "", tINI)
If Readinistring(Chan, "tSection" & i, "", tINI) = Param(Line,2) Then
Writeinistring Chan, Readinistring(Chan, "tSection" & i, "", tINI), GetRest(Line,3), tINI
End If
Next
cTopic = ReadINIString(Chan, "Topic", "", tINI)
For j = 0 To ReadINIString(Chan, "tSections", "", tINI)
cSec = ReadINIString(Chan, "tSection" & j, "", tINI)
secContent = Readinistring(Chan, cSec, "", tINI)
If secContent <> "" Then
cTopic = Replace(cTopic, "%" & cSec & "%", secContent)
End If
Next
If ReadINIString(Chan, "Update", "", tINI) = "1" Then
SendLine "TOPIC " & Chan & " :" & cTopic, 2
Else
Sendline "Notice " & Nick & " :Saved topic to: " & cTopic, 2
End If
ElseIf ParamCount(Line) = 2 Then
Sendline "Notice " & Nick & " :I need to now the content of the section!", 2
ElseIf ParamCount(Line) < 2 Then
cTopic = ReadINIString(Chan, "Topic", "", tINI)
For j = 0 To ReadINIString(Chan, "tSections", "", tINI)
cSec = ReadINIString(Chan, "tSection" & j, "", tINI)
secContent = Readinistring(Chan, cSec, "", tINI)
If secContent <> "" Then
cTopic = Replace(cTopic, "%" & cSec & "%", secContent)
End If
Next
SendLine "TOPIC " & Chan & " :" & cTopic, 2
End If
End Sub