Could someone dumb this down a bit?

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

Animated 0wner
Posts: 36
Joined: 2003-04-09 09:04

Could someone dumb this down a bit?

Post by Animated 0wner » 2003-07-02 04:44

This is concerning the new Neo Modus Client. I realize that it doesn't belong here (seeing as this is the ++ forum), but being a hub owner I need to understand this and I didn't know who else to ask.

As note to ops, hub owners, and script authors, we've implemented multiple hub connections per client in this version. In order for you to cleanly enforce your network rules, you should send a "$GetNetInfo|" string to clients when they connect. If they reply with a '$NetInfo' message it is one of our clients and the message will contain three extra pieces of data - the total number of slots, the number of open hub connections, and weather the client is in active or passive mode.

HaArD
Posts: 147
Joined: 2003-01-04 07:20
Location: Canada http://hub-link.sf.net

Post by HaArD » 2003-07-02 06:02

Discussion about scripting for this new command can be found over here...

HaArD

Animated 0wner
Posts: 36
Joined: 2003-04-09 09:04

Post by Animated 0wner » 2003-07-03 00:42

Thank you for the link. I tried to use the following script written by Tasman there, but I got the error " 1006: Expected ')' " , could one of you please tell me how to fix it?


Code: Select all

'By TasMan

Const MINSLOTS = 1           'Min slots
Const MAXHUBS = 1            'Max hubs
Const HSRATIO = 0.5          'Slot/hub ratio
Const BOTNAME = "DC2"    'BotName
Dim oNetInfo, iCount

Sub Main()
 Set oNetInfo = CreateObject("Scripting.Dictionary")
 iCount = 0
End Sub

Sub DataArival(curUser, sData)
If LeftB(sData, 16) = "$NetInfo" Then
  Check curUser, MidB(sData, 19)
  oNetInfo.Add curUser.sName, curUser.sName
 End If
End Sub

Sub NewUserConnected(curUser)
curUser.SendData "$GetNetInfo|"
End Sub

Sub OpConnected(curUser)
If Not curUser.bOperator Then curUser.SendData "$GetNetInfo|"
End Sub

Sub tmrScriptTimer_Timer()
 iCount = iCount + 1
 If iCount > 15 Then CheckAll
End Sub

Sub Check(curUser, sData)
Dim lPos, iSlots, iHubs, sMsg

lPos = InStrB(1, sData, "$")
iSlots = CInt(LeftB(sData, lPos - 1)

sData = MidB(sData, lPos + 2)
iHubs = CInt(LeftB(sData, InStrB(1, sData, "$") - 1)

Select Case True
  Case iHubs > MAXHUBS: sMsg = "We require you to have less than " & CStr(MAXHUBS) & " connections here."
  Case iSlots < MINSLOTS: sMsg = "We require you to have more than " & CStr(MINSLOTS) & " open."
  Case (iSlots \ iHubs) < HSRATIO: sMsg = "We require you to have at least " & CStr(HSRATIO) & " slots open per hub."
End Select

If LenB(sMsg) Then
  curUser.PrivateMessage CStr(BOTNAME), CStr(sMsg)
  frmHub.DoEventsForMe
  curUser.Disconnect
End If
End Sub

Sub CheckAll()
 Dim oItem

 For Each oItem In oNetInfo.Items
   If colUsers.Online(CStr(oItem)) Then colUsers.ItemByName(CStr(oItem)).SendData "$GetNetInfo|" Else oNetInfo.Remove oItem
 Next
End Sub

HaArD
Posts: 147
Joined: 2003-01-04 07:20
Location: Canada http://hub-link.sf.net

Post by HaArD » 2003-07-03 03:05

There are two ) missing....

Code: Select all

lPos = InStrB(1, sData, "$") 
iSlots = CInt(LeftB(sData, lPos - 1)) '<---- here

sData = MidB(sData, lPos + 2)
iHubs = CInt(LeftB(sData, InStrB(1, sData, "$") - 1)) '<---- and here

Animated 0wner
Posts: 36
Joined: 2003-04-09 09:04

Post by Animated 0wner » 2003-07-03 04:06

Thank you for your quick reply!

Who is online

Users browsing this forum: Google [Bot] and 0 guests