Welcome script? - 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

Welcome script?

Started by YouAlreadyKnow, 17 May, 2006, 01:24:50

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psycho_Chihuahua

#25
well i've checked InfoBot on both k0 Lua 5.02 and k1 Lua 5.1 and it works fine for me.

And Helios as i have stated on the other forum - please give me better details of information on how you got that error - cause i aint gettin no errors ;)

and by the way if you get:
attempt to index global 'PXU' (a nil value)

that means you havent got the version 1.6d as i have put everything together in that one - so you shouldnt get that error as PxUtilities is shipped in the package.

InfoBot 1.6d
unpack as is into ptokax root folder then everything is where its supposed to be - libs in root and script in scripts
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Helios

Syntax F:\recupero\Ptokax\Ptokax\scripts\welcome.lua:53: attempt to concatenate global 'doGetProfile' (a nil value)

Helios

Quote from: Mutor on 09 June, 2006, 02:22:59
Quote from: Helios on 08 June, 2006, 22:29:22
Syntax F:\recupero\Ptokax\Ptokax\scripts\welcome.lua:53: attempt to concatenate global 'doGetProfile' (a nil value)
lol any1 fix it

This stems from bad technique in creating the variable.
doGetProfile =  GetProfileName(user.iProfile)

Will fail on an unregistered user, where  GetProfileName(user.iProfile) will return nil
When it's possible for such a call to return nil [false] it's best to use the or statement
There is also no reason for a global variable here.

so, you might try...

local doGetProfile =  GetProfileName(user.iProfile) or "Unregistered User"

to avoid that error.

Quote from: Helios on 08 June, 2006, 22:34:09
i use ptokax 3.0.4.0k with lua 5.1

It is important to post the full Px version, 0.3.4.0k0 = LUA 5.02, or 0.3.4.0k1 = LUA 5.1 for example.
I do know that that has been addressed [and hopefully fixed by Psycho Chihuahua] in a recent update.
It's a matter of how libs are handled differently in the two LUA versions.
One last thing, you should post this in the InfoBot thread. No here, as it has no bearing.

i have installed this


changed old string with ---------------------> local doGetProfile =  GetProfileName(user.iProfile) or "Unregistered User"

error report   [19:11] Syntax F:\recupero\Ptokax\Ptokax\scripts\welcome.lua:53: attempt to concatenate global 'doGetProfile' (a nil value)

Psycho_Chihuahua

#28
PtokaX doesn't seem to like doGetProfile - i got the same Error there. But its easy to fix - just use a different Var

--// WelcomeMessage made by 6Marilyn6Manson6 17/05/2006
BotName = "[ITA]WelCoMe"			--frmHub:GetHubBotName(),
------------------------------------------------------
function Main()
	frmHub:RegBot(BotName)
end
--// DoShareUnits
DoShareUnits = function(intSize)
	if intSize ~= 0 then
		local tUnits = { "Bytes", "KiB", "MiB", "GiB", "TiB" }
		intSize = tonumber(intSize);
		local sUnits;
		for index = 1, table.getn(tUnits) do
			if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end
		end
		return string.format("%0.3f %s",intSize, sUnits);
	else
		return "0 Bytes"
	end
end
------------------------------------------------------
function NewUserConnected(user)
local doGetProfile = "Unregistered User"
if user.iProfile ~= -1 then doGetProfile = GetProfileName(user.iProfile) end
local name,version = getHubVersion()
local timeanddate = os.date("%d-%m-%Y  %H:%M:%S")
local tmp = os.clock() 
local weeks, days, hours, minutes, seconds = math.floor(tmp/604800), math.floor(math.mod(tmp/86400, 7)), math.floor(math.mod(tmp/3600, 24)), math.floor(math.mod(tmp/60, 60)), math.floor(math.mod(tmp/1, 60))
	if frmHub:GetHubTopic() == nil then
		HubTopic = "No Topic Set"
	else
		HubTopic = frmHub:GetHubTopic()
	end
	if user.sMyInfoString then
		local disp = ""
	end
	border1 = "  <=================Welcome To My-Block Private DVD-r Hub: "..user.sName.."========================>"
	disp = "\r\n\r\n"..border1.."\r\n"
	disp = disp.."	?Hub Version:\t\t\t"..name.." "..version.."\r\n"
	disp = disp.."	?Hub Address:			"..frmHub:GetHubAddress()..":"..frmHub:GetHubPort().."\r\n" 
	disp = disp.."	?Hub Name:			"..(frmHub:GetHubName() or "N/A").."\r\n" 
	disp = disp.."	?Hub Description:			"..(frmHub:GetHubDescr() or "N/A").."\r\n"
	disp = disp.."	?Hub Topic:			"..HubTopic.."\r\n"
	disp = disp.."	?Local date and time:		"..timeanddate.."\r\n"
	disp = disp.."\r\n"
	disp = disp.."	?Your Profile:			"..doGetProfile.."\r\n"
	disp = disp.."	?Your Nick:			"..user.sName.."\r\n"
	disp = disp.."	?Your Current IP:			"..(user.sIP or "N/A").."\r\n"
	disp = disp.."	?Your Client Is:			"..(user.sClient or "N/A").."\r\n"
	disp = disp.."	?Your Client Version Is:		"..(user.sClientVersion or "N/A").."\r\n"
	disp = disp.."	?Your Current Mode Is:		"..user.sMode.."\r\n"
	disp = disp.."	?Your Normal Hubs Are:		"..(user.iNormalHubs or "N/A").."\r\n"
	disp = disp.."	?Your ReG-ViP Hubs Are:		"..(user.iRegHubs or "N/A").."\r\n"
	disp = disp.."	?Your OPerator Hubs Are:		"..(user.iOpHubs or "N/A").."\r\n"
	disp = disp.."	?Your Total Hubs Are:		"..(user.iHubs or "N/A").."\r\n"
	disp = disp.."	?Your Open Slots Are:		"..(user.iSlots or "N/A").."\r\n"
	disp = disp.."	?Your Share Size Is:		"..DoShareUnits(user.iShareSize).."\r\n"
	disp = disp.."	?Your Description Is:		"..(user.sDescription or "N/A").."\r\n"
	disp = disp.."	?Your eMail Is:			"..(user.sEmail or "N/A").."\r\n"
	disp = disp.."	?Your Connection Is:		"..(user.sConnection or "N/A").."\r\n"
	disp = disp.."	?There Are Now "..frmHub:GetUsersCount().." of the "..frmHub:GetMaxUsers().." users online after "..weeks.." week(s) "..days.." day(s) "..hours.." hour(s) "..minutes.." minutes and "..seconds.." seconds\r\n\r\n"
	user:SendData(BotName, disp)
	disp = nil
end
------------------------------------------------------
OpConnected=NewUserConnected
--// 6Marilyn6Manson6


As you see all i did was change 'doGetProfile' to 'Prof' and voila it worked.
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Madman

Px has no problem with doGetProfile...
How ever.. is has a prob with line 36... witch is the reason you get a nil error
remove it and it's solved aswell... ;)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Helios

tnx 1000 Psycho_Chihuahua it work fine now

Helios

[08:17] Syntax F:\recupero\Ptokax\Ptokax\scripts\welcome.lua:42: attempt to call global 'GetEnable' (a nil value)

lol


Psycho_Chihuahua

And how do you get that????


There is no GetEnable Call in welcome.lua
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Helios

i have tested it for 3 days no error
now get this error don't understand why

Psycho_Chihuahua

it is still not possible to get a GetEnable Error unless you added something and doing so - borked it.

if no GetEnable in Script = impossible to get such an Error
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SMF spam blocked by CleanTalk