AuthorMessage
Mickey
Ametuar
Posts: 115

I have made a LUA script for  Verli hub unfortunatelly it is not working. It is not starting at all. Some error messages. It can be fixed easily with debugging but how to debug? Let me paste the script. The script checkks modem users' hub and slot count at connect:
Code:
NotCheckClass = 1    --Minimum class who are not checked
MaxHubCount = 1    --Max hubs allowed
MinSlotCount = 3    --Minimum slots
MaxSlotCount = 3    --Maximum slots
BotNick = ".[IM]Bot"
RedirectAdress = ""
Redirect = false  --// true or false
function GetUserClass(nick)
   res, UserClass = VH:GetUserClass(nick)
   if not res then return 1 else end
function VH_OnParsedMsgMyINFO(nick, data)
   GetUserClass(nick)
   if UserClass < NotCheckClass then
      Check(nick,data)
   end
return 1
end
function Check(nick, data)
   res, myinfo = VH:GetMyINFO(nick)
   myinfo = string.gsub(myinfo, " ", "")
--   ret,c,desc = string.find( myinfo, "^%$MyINFO %$ALL [^ ]* ([^$]*)%$" )
            
--   local Share = string.find(myinfo,"%$%s*([%d%.]+)%$")
--   local Email = string.find(myinfo,"%$%S+%$(.*)%$%s*%d+")
   local Tag   = string.find(myinfo,"(%b<>)%$")
--   local Connection = string.sub(connection, 1, string.len(connection)-1)
   local Connection = string.find(myinfo,"$MyINFO $ALL.*$ $(.*)$.*$")
--   local Desc  = string.find(myinfo,"$ALL%s%S+%s(.*)%b<>%$")
--   local Hubs = string.find(myinfo,"H:(%d+)")
   local h1,h2,h3 = string.find(Tag,"H:(%d+)/(%d+)/(%d+)")
   local Hubs = h1 + h2
   local Slots = 0
   if string.find(Tag, "S:") then
      Slots = string.gsub(Tag, "(.*)S:([%d]*)(.*)", "%2")
      Slots = tonumber(Slots)
   end
   
   if (Connenction == "Modem" or Connenction == "28.8Kbps" or Connenction == "33.6Kbps" or Connenction == "56Kbps") and (Hubs>MaxHubCount or Slots<MinSlotCount or Slots>MaxSlotCount) then
      VH:SendDataToUser("<"..BotNick.."> Dial up modem users are restricted to only "..MaxHubCount.." hub and "..MaxSlotCount.." slots! You have more!|", nick)
      if Redirect == true and nick ~= "%{HubListPinger%}" then
         VH:SendDataToUser("<"..BotNick.."> You are being redirected to "..RedirectAdress.."|", nick)
         VH:SendDataToUser("$ForceMove "..RedirectAdress.."|", nick)
      end
      VH:CloseConnection(nick)
   end
return 1
end

Mickey
Ametuar
Posts: 115

Oki, an End was missing. Now it is loading but is not working yet. OIt doesn't disconnect modem users what is suposed to do. It would be nice to be debugged but how?