how do i add more .txt files
 

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

how do i add more .txt files

Started by [SWE]henrik, 31 December, 2003, 01:11:32

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

[SWE]henrik

Im absolutly a newbie at this software and now i got this trouble to add more .txt files whit info and so on to my users. ive got a script from a very nice owner to another hub but when we run that we couldent get it to work in PM :(
This is a big issiu to me then i like the users to read rules and infos and they cant if it comes up in main, it disaperes while users go on chatting, very anoying  X(
i run the latest public version PtokaX DC Hub 0.3.2.6 test drive 4. plz help me out here
Acoustic & World Music
jokiboxII.no-ip.info

plop

try this 1.
-- texter bot by plop
-- shows text files from a folder named text.
-- doesn't mather what prefix is used.
-- if the file excist it shows.

Bot = "something"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end


function showtext(user, cmd)
   lines = "\r\n\r\n"
   readfrom("text/"..cmd..".txt")
   while 1 do
      local line = read()
      if line == nil then 
         readfrom()
         break 
      end
      lines = lines..line.."\r\n"
   end
   user:SendPM(Bot, lines.." |")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[SWE]henrik

Thank you very much, i must say theres some service here:) ill test it, have to figure it out only... like i said im a newbie and i had like some instructios but the best way to learn can be to make misstakes so thank you anyway, bye
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

this is what i got the third time id try to save your script... i bet you have some luaghs when reading my quotes here;)

this is what i got in my saves:
-- texter bot by plop
-- shows text files from a folder named text.
-- doesn't mather what prefix is used.
-- if the file excist it shows.

Bot = "something"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end


function showtext(user, cmd)
   lines = "\r\n\r\n"
   readfrom("text/"..cmd..".txt")
   while 1 do
      local line = read()
      if line == nil then 
         readfrom()
         break 
      end
      lines = lines..line.."\r\n"
   end
   user:SendPM(Bot, lines.." |")
end
plop
[/QUOTE]

and this is what happend when i tryed to load it:

Syntax Error: expected;
  last token read: `[' at line 1 in string "[code]
..."

 ;(  btw, it is the folder script i save in whit file end .lua, huh?
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

Working now, dont know how id did but in someway its there, whit out errors, thx :)
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

Hi Plop
well as i told in last reply the script is working, at least its no erroe in it but i still does some thing wrong cause i cant get any new .txt file to come up in PM when i add on that my users to have possibilyty to read...

Do i need another script for that pherhaps?
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

well for any reason i still cant get this to work, maybe i should got to bed astead start whit this before i even know how to download the script i got from you Plop but i realy like to get this work...

Theres no errors now when ive got it in scripts but still not working i need help whit following things:
how do i download your script propertly and shall i save it whit .lua?
in wich order shall i work me thru this to get it right?
like--> download the script-->make a .txt doc--> save that in scripts/text, or what?

btw, this is how i at the end saved your script to get it work whit out errors:

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1)
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end


function showtext(user, cmd)
   lines = "\r\n\r\n"
   readfrom("text/"..cmd..".txt")
   while 1 do
      local line = read()
      if line == nil then
         readfrom()
         break
      end
      lines = lines..line.."\r\n"
   end
   user:SendPM(Bot, lines.." |")
end


its much likely that ive missed something but then let me know plz

bye for a while...
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

i suppose its no popular to post this much in one qustion but...

what does this mean:
(from above in the script wich i now dl and get working whit a bot called "something,lol)

-- if the file excist it shows.

i might just think this have something whit the proplem to do, or?
Acoustic & World Music
jokiboxII.no-ip.info

pHaTTy

QuoteOriginally posted by [SWE]henrik
i suppose its no popular to post this much in one qustion but...

what does this mean:
(from above in the script wich i now dl and get working whit a bot called "something,lol)

-- if the file excist it shows.

i might just think this have something whit the proplem to do, or?

no its a commented line it cant be a problem as it has --

anything with -- at the index 1 of the line ie right at beginning (not in quotes) will not be used ;)
Resistance is futile!

[SWE]henrik

QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by [SWE]henrik
i suppose its no popular to post this much in one qustion but...

what does this mean:
(from above in the script wich i now dl and get working whit a bot called "something,lol)

-- if the file excist it shows.

i might just think this have something whit the proplem to do, or?

no its a commented line it cant be a problem as it has --

anything with -- at the index 1 of the line ie right at beginning (not in quotes) will not be used ;)

ok, i was just posting my self that it probleby wasnt that, thx for make me sure at that... but i still cant et it work the way i like, sometimes im near to give it up...
Acoustic & World Music
jokiboxII.no-ip.info

plop

recovering here from new year. lol
you make a folder called "text" in the scripts folder.
if you now make in there a file called "rules.txt" and type in mainchat "!rules" it shows the "rules.txt" file in pm 2 the user who typed it.
if you now make a 2de file called "news.txt" you can make it show my typing "!news".
as you see it needs filenames without spaces and it then uses the part before .txt as command.
the fun part is that it excepts anything from !rules to +rules to even Arules, crules, and it doesn't mather if it's in mainchat or in pm 2 the bot.
the script finds the 1st word a user types, strippes the 1st character and checks if a file with that name excists.
if there is sutch a file it shows, if not it does nothing.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[SWE]henrik

QuoteOriginally posted by plop
recovering here from new year. lol
you make a folder called "text" in the scripts folder.
if you now make in there a file called "rules.txt" and type in mainchat "!rules" it shows the "rules.txt" file in pm 2 the user who typed it.
if you now make a 2de file called "news.txt" you can make it show my typing "!news".
as you see it needs filenames without spaces and it then uses the part before .txt as command.
the fun part is that it excepts anything from !rules to +rules to even Arules, crules, and it doesn't mather if it's in mainchat or in pm 2 the bot.
the script finds the 1st word a user types, strippes the 1st character and checks if a file with that name excists.
if there is sutch a file it shows, if not it does nothing.

plop

thanks mate, i beginn to woundering if i shall dl this ptokax 0.3.2.6 and set it up from the beginning again cause theres something wrong.
There is a folder named text in scripts from the beginning and ofcourse i could leaved som space in the wrong place sence i mostly trying to get this to work at nights when my family sleeps but ive checked and checked again whit out the result id like to have.
Ive chatted to a beta team user thats testing 0.3.3.0 at this moment and shes not having any trouble whit this, she just add a doc.txt whit the info she likes and its working...
Is the solution to erase all and reinstall ptokax 0.3.2.6 test drive 4 and do this all from the beginning?
Acoustic & World Music
jokiboxII.no-ip.info

plop

can you name all scripts your running??
might be caused by some of them, for example glory securitaz filters all commands starting with a ! mark.
i run 0.3.3.0 myself, but i tested it for you on 0.3.2.6 and for me it works fine.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[SWE]henrik

QuoteOriginally posted by plop
can you name all scripts your running??
might be caused by some of them, for example glory securitaz filters all commands starting with a ! mark.
i run 0.3.3.0 myself, but i tested it for you on 0.3.2.6 and for me it works fine.

plop

ok, first of all im a newbie, may need some more advice like where i should put those .txt files and if i need to save them there directly from wordpad or if it is a certain way to do this.
second thing is thad i got the private mess in main, not in PM to a user that i want to
here is my scripts today:
robocop v5
leechblocker
and a script called "stab" wich moore is a funny (?) thing that users can use on eachother to "hurt" themselves.
but that one ive tryied to put out of scripts to.

I am very thankfull of your all getting involved in this matter of mine and look forward to get this working. If there is a concern about anything ill foolow your advices, you think i have to reinstall my PtokaX or anything ill do that
Acoustic & World Music
jokiboxII.no-ip.info

[SWE]henrik

QuoteOriginally posted by plop
can you name all scripts your running??
might be caused by some of them, for example glory securitaz filters all commands starting with a ! mark.
i run 0.3.3.0 myself, but i tested it for you on 0.3.2.6 and for me it works fine.

plop

download it again, saved as PMbot.lua right in to scripts, named as PMBot and this time absolutly nothing happends. I have oen .txt file called test1.txt in 3 differnent places whit different text in like "this is a test from scriptfolder", "this is a test from textfolder" and "this is a test from hub softwarefolder", so if a PM appears ill know from where;)
restarded scripts, nothing, restarded the whole hub, nothing, put every other script out and did the same, nothing, lol is there any way you realy can hep someone like me? ehehehe, well thanks anyway...
Acoustic & World Music
jokiboxII.no-ip.info

plop

i use notepad myself for making those files, but wordpad should do it 2 aslong as you save as txt file.
localtion:   scripts/text/thisisthetextfile.txt
can't see any problem with those other scripts..

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[SWE]henrik

Thank you all for helping me out here, i now have a working script that ill never going to let go:)
Im very thankfull to you all, dont know how many times im going to say that:)
Acoustic & World Music
jokiboxII.no-ip.info

plop

QuoteOriginally posted by [SWE]henrik
Thank you all for helping me out here, i now have a working script that ill never going to let go:)
Im very thankfull to you all, dont know how many times im going to say that:)
yw and just 1 ty is enough. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Pieltre

Hi,

Would it be possible to get the same script, but without it being a bot...  I have already too many bots and I'd prefer if the thing could run in the background, silently...

thanks in advance

plop

QuoteOriginally posted by Pieltre
Hi,

Would it be possible to get the same script, but without it being a bot...  I have already too many bots and I'd prefer if the thing could run in the background, silently...

thanks in advance
just use 1 of the names for this bot which you also use for another bot.
you can have as much bot's as you want all showing under the same name.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk