Basic script with txt file
 

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

Basic script with txt file

Started by QuikThinker, 03 July, 2004, 18:57:49

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

QuikThinker

Hey guys,  Just after a small script (I would imagine) that me & ma OPs can edit so users can display the OPs current fave tunes?

So when a user ran the command !faves 4 instance it would show all the OPs current 5 fave tunes. And another basic command 4 each OP 2 be able 2 just update his/her 5 faves as & when then wish.

Thanx in advance,
Quik.

QuikThinker

Come on guys this should be a walk in the park 4 u!  :D

Herodes

If I have this clear enough, u could use plop's texter ...

QuikThinker

I just tried texter2 & cannot get it 2 work no matter wat! I beg sum1 look at it please?? lol
All I need is the 1 command too, all the rest is surplus.

-- texter bot by plop
-- modified 2 show only 6 files,
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.


Bot = "?PHH?"

FDFolder = "text"

cmd1 = "+faves"
file1 = "faves.txt"

cmd2 = "+ad"
file2 = "ad.txt"

cmd3 = "+help"
file3 = "help.txt"

cmd4 = "+masterhelp"
file4 = "masterhelp.txt"

cmd5 = "+viphelp"
file5 = "viphelp.txt"

cmd6 = "+hubinfo"
file6 = "hubinfo.txt"


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+)") 
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         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(%w+)")
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         return 1
      end
   end
end

function showtext(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end

function showtextmain(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	SendToAll(Bot, "\r\n"..contents.."\r\n|")
end

plop

a texter bot won't help here if i get it right.
you want a bot where ever op has a top5 of tunes.
my texter can only show files, not modify them.

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 <----<<

QuikThinker

Yea I decided that'll do tho coz I can get all the OPs 2 tell me their current top5 & I can edit the txt file maself. But I cant even get texter2 script 2 do that at the mo :s

plop

QuoteOriginally posted by QuikThinker
Yea I decided that'll do tho coz I can get all the OPs 2 tell me their current top5 & I can edit the txt file maself. But I cant even get texter2 script 2 do that at the mo :s
try version 4.x, that is a lot easyer 2 config.
just stuff all the txt files into the text folder, but remember that the filename is gone be the command.

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 <----<<

QuikThinker

OK so now i've tried texter 4.5 & STILL cant get it 2 fuckin work :@ It creates the levels file but dun do nuttin else.

I dun even need suttin this complicated just a simple fuckin script that displays sum info from a txt file in main chat when a user runs a command. Thats all! lol

plop

QuoteOriginally posted by QuikThinker
OK so now i've tried texter 4.5 & STILL cant get it 2 fuckin work :@ It creates the levels file but dun do nuttin else.

I dun even need suttin this complicated just a simple fuckin script that displays sum info from a txt file in main chat when a user runs a command. Thats all! lol
then you need version 1. lol
no !help or config on that, just a folder with files which every1 can view.

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 <----<<

QuikThinker

lol Plop that was all I needed, it does the trick perfectly! Thanx!

Quik.

QuikThinker

The script is perfect & does EXACTLY wat I want except now I got one more problem.....

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 24 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

plop

a updated version is on my site.
should be fixed now.

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 <----<<

QuikThinker

Testin now fingers crossed! :D

QuikThinker

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 18 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 18 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 18 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 18 [file `C:\WINDOWS\DESKTOP\[PHH]\scripts\Texter.lua']

Nearly :(

SMF spam blocked by CleanTalk