Open a new window.
 

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

Open a new window.

Started by Not, 13 November, 2003, 17:39:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Not

Hi, all  :]

I'm a newbie (bigtime he he) with scripting. I've been trying to get my helpfiles to open in a new popup window, and not in main (private message bla bla). The script i'm using looks like this:

Trigger = "!rules"
operatorFile = "rules.txt"
userFile = "rules.txt"

function DataArrival(curUser, data)
  if (strsub(data, 1, 1) == "<") then
    data = strsub(data, 1, strlen(data)-1)
    if (strfind(strlower(data), strlower(Trigger))) then
      if (curUser.bOperator) then
        ReadHelpFile(curUser, operatorFile)
      else
        ReadHelpFile(curUser, userFile)
      end
    end
  end
end

function ReadHelpFile(curUser, theFile)
  local handle = openfile(theFile, "r")
  if (handle ~= nil) then
    local line = read(handle)
    while line do
      curUser:SendData("   "   ..line)
      line = read(handle)
    end
    closefile(handle)
  end
end


I use the same script for getting different helpfiles, and it has to work with testdrive 4.99

I've downloaded script after script, but they all write the file in main, and not a new popup window... I've also tried (trial and error) changing some myself, but with no success  :(  

Could someone please help me with this one?

[T-G-T]M@sto

QuoteOriginally posted by Not
Hi, all  :]

I'm a newbie (bigtime he he) with scripting. I've been trying to get my helpfiles to open in a new popup window, and not in main (private message bla bla). The script i'm using looks like this:

Trigger = "!rules"
operatorFile = "rules.txt"
userFile = "rules.txt"

function DataArrival(curUser, data)
  if (strsub(data, 1, 1) == "<") then
    data = strsub(data, 1, strlen(data)-1)
    if (strfind(strlower(data), strlower(Trigger))) then
      if (curUser.bOperator) then
        ReadHelpFile(curUser, operatorFile)
      else
        ReadHelpFile(curUser, userFile)
      end
    end
  end
end

function ReadHelpFile(curUser, theFile)
  local handle = openfile(theFile, "r")
  if (handle ~= nil) then
    local line = read(handle)
    while line do
      curUser:SendData("   "   ..line)
      line = read(handle)
    end
    closefile(handle)
  end
end


I use the same script for getting different helpfiles, and it has to work with testdrive 4.99

I've downloaded script after script, but they all write the file in main, and not a new popup window... I've also tried (trial and error) changing some myself, but with no success  :(  

Could someone please help me with this one?
Maybe try replase:
curUser:SendData(" " ..line)

with this
curUser:SendPrivateMessage(" " ..line)
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Optimus

curUser:SendPM(" " ..line)


thats the 1 to use

Not

Wow, that was quick :)

No pop up window, tried both suggestions, but didn't work...
looks like this:

Trigger = "!test"
operatorFile = "test.txt"
userFile = "test.txt"

function DataArrival(curUser, data)
  if (strsub(data, 1, 1) == "<") then
    data = strsub(data, 1, strlen(data)-1)
    if (strfind(strlower(data), strlower(Trigger))) then
      if (curUser.bOperator) then
        ReadHelpFile(curUser, operatorFile)
      else
        ReadHelpFile(curUser, userFile)
      end
    end
  end
end

function ReadHelpFile(curUser, theFile)
  local handle = openfile(theFile, "r")
  if (handle ~= nil) then
    local line = read(handle)
    while line do
      curUser:SendPM(" " ..line)
      line = read(handle)
    end
    closefile(handle)
  end
end

Does it matter that it's a privatehub with only regusers?

NightLitch

Here:

BotName = "-Txt-Bot-"

Trigger = "!test" 
operatorFile = "test.txt" 
userFile = "test.txt" 

function Main()
	frmHub:RegBot(BotName)
end 

function DataArrival(curUser, data) 
	if (strsub(data, 1, 1) == "<") then 
		data = strsub(data, 1, strlen(data)-1) 
		if (strfind(strlower(data), strlower(Trigger))) then 
			if (curUser.bOperator) then 
				ReadHelpFile(curUser, operatorFile) 
			else 
				ReadHelpFile(curUser, userFile) 
			end 
		end 
	end 
end 

function ReadHelpFile(curUser, theFile) 
	local handle = openfile(theFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		while line do 
			curUser:SendPM(BotName, line) 
			line = read(handle) 
		end 
	closefile(handle) 
	end 
end

Try this one....
//NL

Optimus

Yups we forgot to do the (BotName) lol

Have a good 1

Not

Wiiiiiiii!    :D

The new one worked right away! Thanks a *lot*, guys!

Now it looks a lot more "proffessional", he he...  8)

SMF spam blocked by CleanTalk