Avatar billede e.p. Nybegynder
07. april 2002 - 23:15 Der er 9 kommentarer og
5 løsninger

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
Avatar billede otis Nybegynder
07. april 2002 - 23:16 #1
Det kunne ligne visualbasic
Avatar billede james_t_dk Juniormester
07. april 2002 - 23:17 #2
ligner C++/Java
Avatar billede dmcn Praktikant
07. april 2002 - 23:17 #3
Ligner MEGET Visual Basic.
Avatar billede james_t_dk Juniormester
07. april 2002 - 23:18 #4
står der ikke noget om det på den nævnte hjemmeside?
Avatar billede otis Nybegynder
07. april 2002 - 23:20 #5
to (incl mig) der siger Visual basic.. så jeg smider et svar :P
Avatar billede e.p. Nybegynder
07. april 2002 - 23:20 #6
der står intet på deres side...
Avatar billede sblar Nybegynder
07. april 2002 - 23:39 #7
3 siger Visual Basic :-)
Avatar billede eqvaliser Nybegynder
08. april 2002 - 00:07 #8
4 siger VB
Avatar billede tipsen Nybegynder
08. april 2002 - 01:14 #9
Det er ikke C++ - Notationen er ikke stringent nok - nærmere VB :-)
Avatar billede theplayer.da.ru Nybegynder
08. april 2002 - 08:03 #10
Yep... ligner Visual Basic rimlig meget....
Avatar billede e.p. Nybegynder
08. april 2002 - 11:14 #11
ok....

Det er ikke java (ved jeg selv)
Det er ikke C++
Altså må det være VB

alle der har "stemt" VB.....smid et svar
Avatar billede sblar Nybegynder
08. april 2002 - 11:17 #12
Får vi så 1 point hver? :-)
Avatar billede dmcn Praktikant
08. april 2002 - 13:42 #13
Svar. :)
Avatar billede e.p. Nybegynder
22. april 2002 - 21:54 #14
1 point til hver :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester