Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Using a table index as a boolean

Using a table index as a boolean

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kevnuke   USA  (145 posts)  Bio
Date Mon 30 Apr 2012 12:07 AM (UTC)

Amended on Sun 06 May 2012 04:30 AM (UTC) by Kevnuke

Message
This is supposed to be a list of skill groups that the script does NOT pass to the SendGMCP function since these groups don't have any abilities. They are all passive.

Jonathan, you should recognize SendGMCP..you wrote it lol



function OnPluginTelnetSubnegotiation (opt, data)

	if opt ~= 201 then

		return

	end

	local msg, content = unpack(utils.split(data, " ", 1))

	print (msg, content)

	if not content or content:len() == 0 then

		_G[msg:gsub("%.", "")]()

	else

		_G[msg:gsub("%.", "")](content)

	end

end

function SendGMCP(message, content)
	if type(message) ~= "string" then
		return nil, "Message name must be a string."
	end
  
	if content ~= nil then
		content = json.encode({content})
		if content == nil then
			return nil, "Invalid input."
		end
		message = ("%s %s"):format(message, content:sub(2, #content-1))
	end
  
	SendPkt(SB_GMCP:format(message))
	return true
end

function CharSkillsGroups (content)

	local EXCLUDED_GROUPS	=	{

		"Antidotes",
		"Avoidance",
		"Constitution",
		"Fitness",
		"Frost",
		"Galvanism",
		"Philosophy",
		"Thermology",

	}

	for k,v in ipairs (JSON.decode("[" .. content .. "]")[1]) do

		system[system.char]	=	{

			skills	=	{

				[v.name]	=	{

					rank		=	v.rank,

				},
			},
	
		}

		if not EXCLUDED_GROUPS [v.name] then

			system[system.char]["skills"][v.name]["abilities"]	=	{}

			local GROUP	=	{group = v.name}

			SendGMCP ("Char.Skills.Get ", GROUP)

		end

	end

end

Run-time error
Plugin: The_System (called from world: Achaea)
Function/Sub: OnPluginTelnetSubnegotiation called by Plugin The_System
Reason: Executing plugin The_System sub OnPluginTelnetSubnegotiation
[string "Plugin"]:223: attempt to call local 'EXCLUDED_GROUPS' (a table value)
stack traceback:
        [string "Plugin"]:223: in function '?'
        [string "Plugin"]:560: in function <[string "Plugin"]:548>
Error context in script:
 219 :    },
 220 :  
 221 :   }
 222 : 
 223*:   if not EXCLUDED_GROUPS {v.name} then
 224 : 
 225 :    system[system.char]["skills"][v.name]["abilities"] = {}
 226 : 
 227 :    local GROUP = {group = v.name}


See my problem?
EDIT: Wow if that wasn't a rookie mistake. See if the top half works now

..also, while I'm on the subject. I don't remember having to do anything special to get the contents of the items field last time I used print to see the Char.Items.List data. All I'm getting now is..

Char.Items.List { "location": "inv", "items": [ ] }

using this


function CharItemsList (content)

	print ("CharItemsList ", content)

end


EDIT: I think it was because I had Twisol's GMCP plugin running at the same time. Lemme check.

..I'll find out as soon as I stop getting Runtime errors in my plugin -sigh-

"x" variable does not exist because you are a retard and have not declared it yet LOL
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,216 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.