command for connections?
Moderator: Moderators
-
- Posts: 6
- Joined: 2003-01-23 10:32
command for connections?
whats the command to reconise the connection users are on ie 56k dsl ect?
Thanks
Thanks
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:
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
-
- Posts: 6
- Joined: 2003-01-23 10:32
-
- Posts: 6
- Joined: 2003-01-23 10:32
well not to my suprise im confussed
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
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
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
-
- Posts: 210
- Joined: 2003-01-23 17:24
- Location: Nevada
- Contact:
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 :
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
here is the "complete" script:
hope you can use it
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
For the newest release of MulTiBoT visit www.cwain.dk
-
- Posts: 210
- Joined: 2003-01-23 17:24
- Location: Nevada
- Contact:
How about :
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 =).
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
Also note that SendChatMessage has 2 parameters : the message, but also who sends it (you forgot to mention it in your original script =).
-
- Posts: 6
- Joined: 2003-01-23 10:32
I must be doing somthing wrong but im puling my hair out trying to get this to work....
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?
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
has anyone else tested this code?
-
- Posts: 210
- Joined: 2003-01-23 17:24
- Location: Nevada
- Contact:
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
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
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:
with
replace the lines:
Code: Select all
curUser.SendChatMessage "damn modem user, get the fuck out of my hub :)"
curUser.Disconnect
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
-
- Posts: 6
- Joined: 2003-01-23 10:32