command for connections?

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

command for connections?

Post by monkeyspunks » 2003-01-23 10:34

whats the command to reconise the connection users are on ie 56k dsl ect?

Thanks

TMM
Posts: 47
Joined: 2003-01-03 19:50
Location: leeds UK
Contact:

Post by TMM » 2003-01-23 21:07

sCon=BeforeFirst(CStr(info(2)),"")
sCon=BeforeFirst(sCon,"")

If sCon=33.6Kbps or sCon=28.8Kbps

is the basics

you could do code to ask if you redirect the slowdems
or just kick em

up 2 u

hope this helps
ashes to ashes, dust to dust, if the dope dont get you. The acid must

TasMan
Posts: 196
Joined: 2003-01-03 08:31
Location: Canada
Contact:

Post by TasMan » 2003-01-24 05:35

That won't always work - say if you're using NMDC (perhaps others) it will use a different char () if you're away, fireball, fileserver, etc.

FRANKE
Posts: 26
Joined: 2003-01-03 11:29
Location: Denmark
Contact:

Post by FRANKE » 2003-01-24 08:51

TasMan is right
This is a MyINFO string:
$MyINFO $ALL <username> <description>$ $<Connection><mode>$<email>$<share size>$

<mode> can be a character code of any value between 1 and ? (255 i think), so what you want to do is something like this:

Code: Select all

strCon = AfterFirst(strMyInfo, "$ALL")
strCon = AfterFirst(strCon, "$")
strCon = BeforeFirst(strCon, "$")
strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code
'Now strCon only contains the connection.
For the newest release of MulTiBoT visit www.cwain.dk

monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

Post by monkeyspunks » 2003-01-24 09:11

cheers for your help guys much apresheated

I will give it a go and let u know....

Thanks Monkey

monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

Post by monkeyspunks » 2003-01-24 10:03

well not to my suprise im confussed :? :?:

Code: Select all

dim sBotName
dim strcon


sub main()
sBotName = "!TESTBOT!"
frmHub.RegisterBotName cstr(sBotName)
end sub

sub OpConnected (curUser) 'This event is fired when an op connects to the hub.

strCon = AfterFirst(strMyInfo, "$ALL") 
strCon = AfterFirst(strCon, "$") 
strCon = BeforeFirst(strCon, "$") 
strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code 
'Now strCon only contains the connection. 



curUser.PrivateMessage CStr(sBotName), CStr(strCon)


end sub
Thats What code i have got, the PM does not arrive i have tryed dim'in AfterFirst ect just wonered if som1 clever could tell me...

PS: i dont want it to PM the connection as its use if i can get strcon to equal somthing i can compair ect the PM is for testing :)

Thanks

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-01-24 12:33

There's probably 2 problems here...

The first is obvious : you don't define strMyInfo

You'd need 2 extra lines:
Dim strMyInfo
strMyInfo = curUser.sMyInfoString

Or drop the strMyInfo variable and go directly with

strCon = AfterFirst(curUser.sMyInfoString, "$ALL")

-----

The second problem is you apparently use it in the OpConnected Sub, in which case you will need to recover the myinfo string as a property of the clsDCUser object (namely the .sMyInfoString property). However, if I remember well, this string doesn't start with $all, so you'll have to test a bit and PM yourself the whole chain and see from there how it's structured exactly (don't forget to CStr it before PMing it, or the hub will be mad at you =)

The myInfo string that starts with $all is the one broadcasted to the hub upon connecting, and you can use your approach to split that one, but you'll need to grab it from the DataArival sub, not the OpConnected sub =)

Just to be sure, and have it work from any myInfo string, you can start the spliting after the username, instead of after the "$all". Something in the line of :

Code: Select all

Sub OpConnected (curUser)
Dim strCon

With curUser
strCon = AfterFirst(.sMyInfoString, .sName) 
strCon = AfterFirst(strCon, "$") 
strCon = BeforeFirst(strCon, "$") 
strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code 
'NOW strCon contains the connection =)

.PrivateMessage CStr(sBotName), CStr(strCon) 
End With
End Sub
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-24 13:14

Hint (before you go mad "why doesn't this work at all"): curUser.sMyInfoString stays empty until the user actually sends $MyINFO - and that doesn't happen in NewUserConnected/OpConnected - you'll have to watch DataArival for $MyINFO

monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

Post by monkeyspunks » 2003-01-24 15:59

Thanks to all will give it a wirl :lol:

cheers monkey

FRANKE
Posts: 26
Joined: 2003-01-03 11:29
Location: Denmark
Contact:

Post by FRANKE » 2003-01-24 16:45

here is the "complete" script:

Code: Select all

Sub DataArival (curUser, sCurData)
   
   Dim strCon
   
   if Left(sCurData, 7) = "$MyINFO" then
      strCon = AfterFirst(sCurData, "$ALL") 
      strCon = AfterFirst(strCon, "$") 
      strCon = BeforeFirst(strCon, "$") 
      strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code 
      
      'Now strCon only contains the connection. 
      select case strCon
         case "28.8Kbps"
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)"
            curUser.Disconnect
         case "33.6Kbps"
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)"
            curUser.Disconnect
         case "56Kbps"
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)"
            curUser.Disconnect
         case "Satellite"
            'do something
         case "ISDN"
            'do something
         case "DSL"
            'do something
         case "Cable"
            'do something
         case "LAN(T1)"
            'do something
         case "LAN(T3)" 
            'do something
      end select
   end if
End Sub
hope you can use it
For the newest release of MulTiBoT visit www.cwain.dk

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-01-24 17:16

How about :

Code: Select all

Option Explicit 'Really, it DOES save resources =)

Sub DataArival (curUser, sCurData) 
    
   Dim strCon 
    
   if Left(sCurData, 7) = "$MyINFO" then 
      strCon = AfterFirst(sCurData, "$ALL") 
      strCon = AfterFirst(strCon, "$") 
      strCon = BeforeFirst(strCon, "$") 
      strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code
      'Now strCon only contains the connection. 
      Select Case Right(strCon, 4)
         Case "Kbps" 
            curUser.SendChatMessage "RealMeanBot", "damn modem user, get the fuck out of my hub :)" : frmHub.DoEventsForMe : curUser.Disconnect 
         Case Else
            'do something 
      End Select 
   end if 
End Sub 
If you send a PM/Chat message to someone, they won't always get it if you disconnect them right after. You'll need to put that DoEvents if you want to be sure they get it.
Also note that SendChatMessage has 2 parameters : the message, but also who sends it (you forgot to mention it in your original script =).
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

Post by monkeyspunks » 2003-01-27 10:47

I must be doing somthing wrong :oops: but im puling my hair out trying to get this to work....

Code: Select all

Dim sBotName

sub main()
sBotName = "dfgMonkeys eyes 24/7"
frmHub.RegisterBotName cstr(sBotName)
end sub


Sub DataArival (curUser, sCurData) 
    
   Dim strCon 
    
   if Left(sCurData, 7) = "$MyINFO" then 
      strCon = AfterFirst(sCurData, "$ALL") 
      strCon = AfterFirst(strCon, "$") 
      strCon = BeforeFirst(strCon, "$") 
      strCon = Left(strCon, len(strCon)-1) 'removes the <mode> character code 
      
      'Now strCon only contains the connection. 
      

select case strCon 
         case "28.8Kbps" 
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)" 
            curUser.Disconnect 
         case "33.6Kbps" 
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)" 
            curUser.Disconnect 
         case "56Kbps" 
            curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)" 
            curUser.Disconnect 
         case "Satellite" 
            'do something 
         case "ISDN" 
            'do something 
         case "DSL" 
            'do something 
         case "Cable" 
            'do something 
         case "LAN(T1)" 
            'do something 
         case "LAN(T3)" 
            'do something 
      end select 
   end if 
End Sub
That is what i have i have tryed puting a PM on line 21(about) as well but that does not come up with the connection :?

has anyone else tested this code?

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-01-27 13:23

1) Your bot name contains spaces. That's usualy a bad thing, espeically if you register the botname, since spaces aren't allowed for usernames
2) Check the comments I made in my last post, as to why your PMs probably don't get sent
3) Start your script with Option Explicit, or you'll pump up resources for nothing =) I know vbs isn't exactly gentle on the resources anyway, but it's still not a reason to waste them =p
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

FRANKE
Posts: 26
Joined: 2003-01-03 11:29
Location: Denmark
Contact:

Post by FRANKE » 2003-01-27 13:45

sorry monkeyspunks it is properly my fault, there is an error in the script (if you are lucky there is more the one :))

replace the lines:

Code: Select all

curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)" 
curUser.Disconnect 
with

Code: Select all

curUser.SendChatMessage "BotName", "damn modem user, get the fuck out of my hub :)" 
frmHub.DoEventsForMe
curUser.Disconnect 
For the newest release of MulTiBoT visit www.cwain.dk

monkeyspunks
Posts: 6
Joined: 2003-01-23 10:32

Post by monkeyspunks » 2003-01-27 14:38

right i have no hair left lol if you hav'nt guessed still not working :(

could somone else please test this?

i have tryed everything :?

Thanks for all your help 8)

Locked