need help to my DataArrival - Page 2
 

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

need help to my DataArrival

Started by Themaster, 24 September, 2004, 01:25:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themaster

now i got to work..But my OpChat it do not ?

function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end

   if (strsub(data, 1, 1) == "<" ) then
   local data=strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = UserCommands(user, data, cmd)
         return Commands
      end
   end
   
   if strsub(data, 1, 5) == "$To: " then
      local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
         if to == OpChat then
            if user.bOperator then
               local s,e,msg = strfind(text,"^%b<>%s+(.+)")
               OpChatRoom(user,msg)
            end
         end
      end
   end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

i got a problem now again i can't get my rules to work
it made a error

[/code]
Syntax error: attempt to call global `ShowRules' (a nil value)
stack traceback:
   1:  function `Commands' at line 24 [file `blade/Commands.lua']
   2:  function `DataArrival' at line 89 [file `...\Blade? 1.0.lua']
[/code]

and here is where is the make the error

elseif cmd == "rules" then
      ShowRules(user)
      return 1

if (strsub(data, 1, 1) == "<" ) then
   local data=strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = Commands(user, data, cmd)
         return Commands
      end
   end


I Got this function

rules = "blade/txt/rules.txt"
network = "blade/txt/network.txt"
faq = "blade/txt/faq.txt"


function advert(message, where)
	tosend = ""
	border = strrep ("~", strlen (message)*2/3+2)
	tosend = "\r\n\r\n"..border.."\r\n"..message.."\r\n"..border.."\r\n"
	if (where == "PM") then
		SendPmToAll(BotName, tosend)
	else
		SendToAll(BotName, tosend)
	end
end

function Readtextfile(user, file)
   	local filecontents = ""
	local handle = openfile(file, "r")
	if (handle ~= nil) then
		local line = read(handle)
		while line do
        	filecontents = filecontents..line.."\r\n"
		line = read(handle)
		end
		closefile(handle)
      	user:SendPM(Bot, filecontents)
	end
end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

well I couldnt notice any function named ' ShowRules ' in the script parts that u provide ...

so I suspect that is the problem ...

my suggestion is to change this
elseif cmd == "rules" then
      ShowRules(user)
      return 1
to
elseif cmd == "rules" then
      Readtextfile(user, rules)
      return 1

Themaster

I can get another DataArrival on that i make...et get a error

this is my data

if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = Commands(user, data, cmd)
         return Commands
      end
   end

and here are the next data is from kenny...
   	if (strsub(data,1,1) == "<") then
   		data=strsub(data,1,strlen(data)-1)
   		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
			if user.bOperator then
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

So what is the error ?

Themaster

Help i got a wrong stoff when i log on to my hub in main.. i just wont to have word replace on my script at now this get in main when log on

[17:52:46]  $MyINFO $ALL Themaster? Blade? Creator$ $DSL$$12042852195$

here are this on my dataarrival
  replaced = nil
	local newmsg = gsub(data,"(%w+)",
   function (word)
         if tWords[strlower( word )] then
				replaced = 1
				return tWords[strlower( word )]
			else
            return word
			end
		end)
	if replaced then
		SendToAll(" "..newmsg.."|")
		return 1
	end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

sorry that lil bit of script doesnt help to understand what is going on ..

Themaster

here are all my Data
function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
   
   if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = Commands(user, data, cmd)
         return Commands
      	elseif Kennylizednicks[user.sName] == 1 then
            text=kennytext[random(1, getn(kennytext))]
				SendToAll(user.sName, text)
				return 1
         end
      end
   
   replaced = nil
	local newmsg = gsub(data,"(%w+)",
   function (word)
         if tWords[strlower( word )] then
				replaced = 1
				return tWords[strlower( word )]
			else
            return word
			end
		end)
	if replaced then
		SendToAll(" "..newmsg.."|")
		return 1
	end

   if strsub(data, 1, 5) == "$To: " then
      local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
         if to == OpChat then
            if user.bOperator then
               local s,e,msg = strfind(text,"^%b<>%s+(.+)")
               OpChatRoom(user,msg)
            end
         end
      end
   end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

i have made it now
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

#34
if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
This can be like
  if (strsub(data,1,7) == "$MyINFO") then
      TagCheck(Parse(data),user)
   end
also this
     if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
          local Commands = Commands(user, data, cmd)
         return Commands
can be like this
     if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         return Commands(user, data, cmd)
And this ...
if (to == OpChat) then
               if (user.bOperator) then
to this ..
if (to == OpChat) and (user.bOperator) then

  all the changes that I propose target to shorten the code ,...
this ofcourse has some disadvantage in reading the code ...
so while developing it is better to keep everything not so packed in like I mention ... but ofcourse thats up to you to see ...

PS : Glad you could find the problem ;)

Themaster

hmmm now i got this error when i use ? on my hub


Syntax error: table index is nil
stack traceback
1:  function `DataArrival' at line 101 [file `...den lille\Skrivebord\Hub\scripts\Blade? 1.0.lua']

function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
   
   if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
       [COLOR=red]  prefixcmd = Tprefix[prefix]..cmd[/COLOR] 
         local Commands = Commands(user, data, cmd)
         return Commands
      	elseif Kennylizednicks[user.sName] == 1 then
            text=kennytext[random(1, getn(kennytext))]
				SendToAll(user.sName, text)
				return 1
         end
      end
   
   replaced = nil
	local newmsg = gsub(data,"(%w+)",
   function (word)
         if tWords[strlower( word )] then
				replaced = 1
				return tWords[strlower( word )]
			else
            return word
			end
		end)
	if replaced then
		SendToAll(""..newmsg.."|")
		return 1
	end

   if strsub(data, 1, 5) == "$To: " then
      local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
         if to == OpChat then
            if user.bOperator then
               local s,e,msg = strfind(text,"^%b<>%s+(.+)")
               OpChatRoom(user,msg)
            end
         end
      end
   end

The red is there when error are
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

lets see the Tprefix table
Everything could have been anything else and it would have just as much meaning.

Herodes

yeah .. that variable ('prefix') is refering to an index in the table ... if the table doesnt contain the value of 'prefix' then it returns that "table index is nil" message ... simply because it isnt there ...

Themaster

--// Commands prefix
Tprefix = {
["!"]=1,
["+"]=1,
["#"]=1,
["?"]=1,
["-"]=1,
 }
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

master ... try this 1 ...
change this
if Tprefix[prefix] and cmd then

to this ..
if Tprefix[prefix] ==1 then 
if cmd then

Themaster

still the same error
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

then try a

for i , v in tPrefix do .... end

thing ...

bastya_elvtars

local _,_,cmd=strfind(data,"%b<>%s+([%!%+%#%?%-]%S+)")

safest way, no need 4 prefix table, its like using a cannon for hunting sparrows
Everything could have been anything else and it would have just as much meaning.

Themaster

i can't get it work write
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

my command do not work when i chance to your's line sry
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

Now i have fin out is not write in my DataArrival it do whith the first i made :S

i Realy need Some help
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

i don't now why it do it when i past ? in the main it get's a nil function in ptokax...plz help
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

QuoteOriginally posted by Themaster
i don't now why it do it when i past ? in the main it get's a nil function in ptokax...plz help
Uhm ... how about posting your Main() ?

Themaster

Hmm...i can't fix that error
i still have the same problem when ? come in main..how can i get it work so there are no problem ????

function Main()
   loadfile(savekicks)
   frmHub:UnregBot(BotName)
	frmHub:RegBot(BotName)
   frmHub:RegBot(OpChat)
   TimeSpanInMinutes = 60
   SendToAll(BotName,"?-=-=-=-? Script Reloaded at: "..date("  %X -- %d/%m-%Y").." ?Version? "..Version.." ?Build? "..Build.." ?Creators? "..Creators.." ?-=-=-=-?")
	BotNameInfo = "$MyINFO $ALL "..BotName.." <++V:1.0 Blade? 1.0,C:Themaster? $ $LAN(T3)"..strchar( 1 ).."$$"
   OpChatInfo = "$MyINFO $ALL "..OpChat.." <++V:1.0 Blade? 1.0,C:Themaster? $ $LAN(T3)"..strchar( 1 ).."$$"
   SendToAll(ScriptRestart)
   SendToAll(BotNameInfo) 
   SendToAll(OpChatInfo)
	SetTimer(TimeSpanInMinutes*60000)
	StartTimer()
end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Herodes

oooh now I get it ... you mean the MainChat ! :)

that fault has to be data arrival ...

check the line the error happens ...
identify what variables are used ...
and make sure they all have values in them ( meaning that they should be declared at some point before that line ... )

if they have all been declared by a function
then try to make sure that the function returns real values ... (not nil)

SendToAll, SendToNick and so on should
help you "scan" through the various part and the various variable values ...

SMF spam blocked by CleanTalk