missing last letter of what i input
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

missing last letter of what i input

Started by EXNET OWNER, 28 September, 2004, 01:54:35

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

EXNET OWNER

?(  i have developed the script below but when i use +change name it misses the last character that i put in eg i use +change name me it will say 'm' as the bot name???

help me please

EXNET OWNER

-- AnarchyBot v1.5 by Exile

assert(dofile("Anarchy.ini"),"Anarchy.ini not found, check your ptokax path")


tThem = {"-???x?L???-"}


function Main()
Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
   RegTheBot(BotName)
end

function UnregTheBot(Bot)
   frmHub:RegBot(Bot)
   frmHub:UnregBot(Bot)
end

function RegTheBot(Bot)
   frmHub:UnregBot(Bot)
   SendToAll (Bot_sMyInfoString)
   frmHub:RegBot(Bot)
end


function NewUserConnected(user)
   if tThem[user.sName] == nil then
      tThem[user.sName] = 1
   end
if user.sName == WhoCan then
      customCMDS(user)
      user:SendData("\r\n***AnarchyBot? is in Operation***")
   else
      return

   end

end

function Disconnected(user)
   if tThem[user.sName] then
      Them[user.sName] = nil
   end
end


function OpConnected(user)
customCMDS(user)
   if user.sName == WhoCan then
      local tRCs = {
            "$UserCommand 0 7|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Bot Name $<%[mynick]> "..ChangeCmd.." name %[line: New Name for the Bot]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Description $<%[mynick]> "..ChangeCmd.." description %[line: New Description for the Bot]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Connection $<%[mynick]> "..ChangeCmd.." connection %[line: Change the connection of the Bot]|",
                                "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Version $<%[mynick]> "..ChangeCmd.." tag v %[line: Change the Version in the tag of the Bot]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Mode $<%[mynick]> "..ChangeCmd.." tag m %[line: Change the Mode in the tag of the Bot]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Hubs\\Guest $<%[mynick]> "..ChangeCmd.." tag hg %[line: Change the number of Guest Hubs in the tag]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Hubs\\Registered $<%[mynick]> "..ChangeCmd.." tag hr %[line: Change the number of Reg Hubs in the tag]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Hubs\\Operator $<%[mynick]> "..ChangeCmd.." tag ho %[line: Change the number of Op Hubs in the tag]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Tag\\Slots No. $<%[mynick]> "..ChangeCmd.." tag s %[line: Change the number of Slots in the tag]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Email $<%[mynick]> "..ChangeCmd.." tag s %[line: Change the Bot's Email]|",
            "$UserCommand 1 2 AnarchyBot? by Exile\\Share $<%[mynick]> "..ChangeCmd.." tag s %[line: Change Bot's Share]|",

            };
      for i , v in tRCs do
         user:SendData(tRCs)
      end
end

end
            
function DataArrival(user, data)

if strsub(data, 1,1) == "$" then
      s,e,cmd = strfind(data, "%$(%S+)")
      if cmd == "Search" or cmd == "ConnectToMe" or cmd == "RevConnectToMe" then
         if not user.bOperator then
            for i , v in tThem do
               him = GetItemByName(i)
               him:SendData(data)
            end
            return 1
         end
      end
   end

if user.sName == WhoCan then
      if strsub(data,1,1)=="<" then
         data=strsub(data,1,strlen(data)-1)
         s,e,cmd,name = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
            if cmd == DropCmd then
               frmHub:UnregBot(name)
               SendToAll("<"..name.."> I'm gone blud")
               SendToAll("<"..name.."> -=1=-")
               SendToAll(" The Operator "..name.." Left The Hub")
               return 1
            elseif cmd == AddCmd then
               frmHub:RegBot(name)
               SendToAll(" The Operator "..name.." Has Entered The Hub")
               SendToAll("<"..name.."> Safe evry1, wots gwanin?")
               return 1
                                elseif cmd == AwayCmd then
            frmHub:RegBot(name)
            SendToAll("<"..name.."> "..AwayMsg.."")
            SendToAll("<"..name.."> -=1=-")
            SendToAll(" The Operator "..name.." told us at "..date("%H:%M").." that he/she is away! - Message: BL?$$")
            return 1
            elseif cmd == BackCmd then
            frmHub:RegBot(name)
            SendToAll("<"..name.."> "..BackMsg.."")
            SendToAll(" The Operator "..name.." returned at "..date("%H:%M").."!")
            return 1
end
end
end


   if ( user.bOperator and (user.sName == WhoCan) ) then
   data = strsub(data,1,strlen(data)-1)
      _,_,cmd, what, arg = strfind(data, "%b<>%s+(%S*)%s(%S+)%s(.*)")
            if cmd == ChangeCmd then
            if ( (what ~= nil or what ~= "") and ( arg ~= nil or arg ~= "") ) then
               if what == "description" then
               Description = arg
               Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
               RegTheBot(BotName)
               return 1
            elseif what == "connection" then
               Connection = arg
               Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
               RegTheBot(BotName)
               return 1
            elseif what == "email" then
               Email = arg
               Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
               RegTheBot(BotName)
               return 1
                                elseif what == "tag" then
               s,e,que = strfind(arg, "(%S+)")
                  if que == "v" then
                     s,e,num = strfind(arg , "%S+%s(%d+%.%d+)")
                     if num then
                     Tag = "<++ V:"..num..",M:"..Mode..",H:"..HubsGuest.."/"..HubsReg.."/"..HubsOp..",S:"..Slots..">"
                     else user:SendData("", "The version has to be in the form of #.### where # is a number.")
                     end
                                               
                  elseif que == "m" then
                     s,e,mod = strfind(arg, "%S+%s(%S)")
                     if mod then
                     Tag = "<++ V:"..Version..",M:"..mod..",H:"..HubsGuest.."/"..HubsReg.."/"..HubsOp..",S:"..Slots..">"
                     end
                  elseif que == "ho" then
                     s,e,ho = strfind(arg, "%S+%s(%d+)")
                     if ho then
                     Tag = "<++ V:"..Version..",M:"..Mode..",H:"..HubsGuest.."/"..HubsReg.."/"..ho..",S:"..Slots..">"
                     else user:SendData("", "The Operator Hubs value needs to be a number.")
                     end
                  elseif que == "hr" then
                     s,e,hr = strfind(arg, "%S+%s(%d+)")
                     if hr then
                     Tag = "<++ V:"..Version..",M:"..Mode..",H:"..HubsGuest.."/"..hr.."/"..HubsOp..",S:"..Slots..">"
                     else user:SendData("", "The Registered Hubs value needs to be a number.")
                     end
                  elseif que == "hg" then
                     s,e,hg = strfind(arg, "%S+%s(%d+)")
                     if hg then
                     Tag = "<++ V:"..Version..",M:"..Mode..",H:"..hg.."/"..HubsReg.."/"..HubsOp..",S:"..Slots..">"
                     else user:SendData("", "The Guest Hubs value needs to be a number.")
                     end
                  elseif que == "s" then
                     s,e,sl = strfind(arg, "%S+%s(%d+)")
                     if sl then
                     Tag = "<++ V:"..Version..",M:"..Mode..",H:"..HubsGuest.."/"..HubsReg.."/"..HubsOp..",S:"..sl..">"
                     else user:SendData("", "The Slots value needs to be a number.")
                     end
                  else
                     local msg = "Please use the tag changes as follows:\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag v\t\tchanges the version\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag m\t\tchanges the mode\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag ho\t\tchanges the number of Operator Hubs\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag hr\t\tchanges the Registered Hubs\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag hg\t\tchanges the number of Guest Hubs\r\n"
                           msg = msg.."\t"..ChangeCmd.." tag s\t\tchanges the slots number"
                     user:SendData("", msg)
                     return 1
                  end
               Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
               RegTheBot(BotName)
               return 1
            elseif what == "name" then
               s,e,arg = strfind(arg, "(%S+)")
               UnregTheBot(BotName)
               BotName = arg
               Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
               RegTheBot(BotName)
               return 1
            elseif what == "share" then
               if strfind(arg, "%d+") then
                  Share = arg   
                  Bot_sMyInfoString = "$MyINFO $ALL "..BotName.." "..Description..Tag.."$ $"..Connection.."$"..Email.."$"..Share.."$|"
                  RegTheBot(BotName)
               else
                  user:SendData("", "the share has to be in numbers and is in byte format")


               end
               return 1
            else user:SendData("", "please use one of the following : description / name / connection / email / share / tag ")
end
end
end
end
end


function customCMDS(user)
   user:SendData("$UserCommand 1 3 AnarchyBot? by Exile\\Bot Status\\Bot Exit Hub $<%[mynick]> "..DropCmd.." %[line:BotName]||")
   user:SendData("$UserCommand 1 3 AnarchyBot? by Exile\\Bot Status\\Bot Enter Hub $<%[mynick]> "..AddCmd.." %[line:BotName]||")
   user:SendData("$UserCommand 1 3 AnarchyBot? by Exile\\Bot Status\\Bot Status Away $<%[mynick]> "..AwayCmd.." %[line:BotName]||")
   user:SendData("$UserCommand 1 3 AnarchyBot? by Exile\\Bot Status\\Bot Status Back $<%[mynick]> "..BackCmd.." %[line:BotName]||")
end

VidFamne

#2
You use this twice;
data = strsub(data,1,strlen(data)-1)
in the same function, thats why its cut off the last character.
Try to comment away the second one.

EXNET OWNER

thankyou but i am going to run the scripts seperately as it works better with the GUI i am developing which should be released tonight hopefully...its only a basic bot but i am developing the script and the GUI at the same time...plus i am learning VB on the way! its a lot to do at once. ;)

SMF spam blocked by CleanTalk