Hvilket sprog er dette
How to write an MinShareBot Script'Author: Jon Hess
'Website: http://www.neo-modus.com
'Notes: This script is a tutorial and ment to be run on a Direct Connect Hub of version 1.0 or higher.
'For this Bot we'll keep some public variable to hold general info that the bot will use.
Dim ThisBotsName 'This line makes a variable called "ThisBotsName". We'll keep the bots name in here
Dim iMinSharedBytes
'This next line starts the Main() sub routine. This is where every Direct Connect Hub Script starts.
Sub Main()
ThisBotsName = "AutoBot" 'Here we set the ThisBotsName varialbe to equal the bots name. Change this if you want a differen't name.
iMinSharedBytes = 50 * 1024 ^ 2
End Sub
'When clients connect, one of the messages they send in is a $MyINFO message. This message holds, amoung other things, how many bytes the client is shareing.
Sub DataArival (curUser, sCurData) 'This event is fired when a new user logs in.
Dim sCommand
Dim iTheirSharedBytes
Dim x
If isCommand(sCurData) then
If Instr(1,sCurData," ") > 0 Then
sCommand = BeforeFirst(sCurData, " ")
Else
sCommand = sCurData
End If
Select Case sCommand
Case "$MyINFO"
For x = 1 to 6
sCurData = AfterFirst(sCurData,"$")
Next
iTheirSharedBytes = cdbl(BeforeFirst(sCurData,"$"))
If iTheirSharedBytes < iMinSharedBytes Then
curUser.SendChatMessage cstr(ThisBotsName), "You have not met the minimum share of 20 Megabytes. Please come back when you have that much data to share."
frmHub.DoEventsForMe
curUser.Disconnect
End If
End Select
End If
end sub
Function BeforeFirst(sIn, sFirst)
BeforeFirst = Left(sIn, InStr(1, sIn, sFirst) - 1)
End Function
Function AfterFirst(sIn, sFirst)
AfterFirst = Right(sIn, Len(sIn) - InStr(1, sIn, sFirst) - (Len(sFirst) - 1))
End Function
Function isCommand(sData)
isCommand = (Left(sData,1)="$")
End Function
Public Function AfterLast(sFrom, sAfterLast)
If InStr(1, sFrom, sAfterLast) Then
AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1))
Else
AfterLast = ""
End If
End Function
