Anyone gonna help a newbie? Again...

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Anyone gonna help a newbie? Again...

Post by LuaWeaver »

Sorry about this. I just have this error in mai code.

function love.draw()
if not selected then
love.graphics.print("PLEASE SELECT A GRID SIZE 4-8", 200, 200)
else
local h=love.getSize(W) --These 2 are in a different script. Just gets height and width of screen. Made it to save typing.
local t=love.getSize(H)
h=h/selected
t=t/selected
grid=love.graphics.newQuad(0, 0, 242, 241, h, t)
love.graphics.drawq("blank.png", grid, 0, 0, 0, 0, 0, 0, 0) --Here's the error! Says "Incorrect parameter : expected userdata"
end
end
"your actions cause me to infer your ego is the size of three houses" -finley
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Anyone gonna help a newbie? Again...

Post by vrld »

LuaWeaver wrote:Sorry about this. I just have this error in mai code.
  1. Please use the code-tag,
  2. Please state clearly what error message you are getting (not only as a comment in the code),
  3. You need to use an image object instead of a string:

Code: Select all

-- in love.load():
blank = love.graphics.newImage("blank.png")

-- in love.draw():
love.graphics.drawq(blank, grid, 0, 0, 0, 0, 0, 0, 0)
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: Anyone gonna help a newbie? Again...

Post by LuaWeaver »

Oh, duh. (facepalm) Thanks. I'll fix it right now, I thought I could directly call the source, something like ROBLOX used to work. Speaking of which, NEVER GO THERE. :P. Next time I'll use code and not as a comment.
"your actions cause me to infer your ego is the size of three houses" -finley
EMB
Citizen
Posts: 70
Joined: Sat Jan 08, 2011 8:49 pm

Re: Anyone gonna help a newbie? Again...

Post by EMB »

LuaWeaver wrote:Speaking of which, NEVER GO THERE. :P.
Why? It's the easiest place to learn Lua...
Request Programs
If Linux were a beer, it would be shipped in open barrels so that anybody could piss in it before delivery
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: Anyone gonna help a newbie? Again...

Post by LuaWeaver »

EMB wrote:
LuaWeaver wrote:Speaking of which, NEVER GO THERE. :P.
Why? It's the easiest place to learn Lua...
Sure, but that doesn't necessarily mean the best. If you let people look at other's scripts it makes you feel kind of worthless. Look at this one for example.

Code: Select all

local player=game.Players.BrandonFireflower
local mNameOn=false

function onChat(msg)
	local me=player
	if string.lower(string.sub(msg,1,2))=="ab" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 4, 7)) then
				c[i].Character:remove()
				c[i].Character=game.Workspace
			end
		end
	end
if string.sub(msg, 1, 3)=="/sc" then
	if string.lower(string.sub(msg,5,8))=="jump" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 10, 14)) then
				c[i].Character.Humanoid.Jump=true
			end
		end
	end

	if string.lower(string.sub(msg,5,12))=="loopkill" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 14, 18)) then
				while true do
					wait()
					c[i].Character:BreakJoints()
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,12))=="explode" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 13, 17)) then
				local z=Instance.new("Explosion")
				z.Position=c[i].Character.Torso.Position
				z.Parent=workspace
			end
		end
	end

	if string.lower(string.sub(msg,5,8))=="kill" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 10, 14)) then
				c[i].Character.Humanoid.Health=nil
			end
		end
	end

	if string.lower(string.sub(msg,5,8))=="lol" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 9, 13)) then
				local shield=Instance.new("Part") local Player=game.Workspace:findFirstChild(c[i].Name)
				shield.Shape=0
				shield.Anchored=true
				while true do
					wait()
					for i=1, 10, 0.1 do
						wait(0.1)
						local InstaShield=shield:clone()
						InstaShield.Size=Vector3.new(i, i, i)
						InstaShield.Parent=Player
						InstaShield.CFrame=Player.Torso.CFrame
					end
					player.Torso.CFrame=CFrame.new(0, 50, 0)
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,11))=="freeze" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 12, 16)) then
				c[i].Character.Torso.Anchored=true
			end
		end
	end


	if string.lower(string.sub(msg,5,9))=="thaw" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 10, 14)) then
				c[i].Character.Torso.Anchored=false
			end
		end
	end

	if string.lower(string.sub(msg,5,5))=="k" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 7, 11)) then
				if c[i]~=me then
					c[i]:remove()
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,5))=="b" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 7, 11)) then
				if c[i]~=me then
					while true do
						wait()
						game.Players:findFirstChild(h):remove()
					end
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,8))=="bos" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			if c[i]~=me then
				while true do
					wait()
					game.Players:findFirstChild(h):remove()
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,8))=="kos" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			if c[i]~=me then
				c[i]:remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,11))=="rebase" then
		local h=Instance.new("Part", workspace)
		h.Size=Vector3.new(512, 1, 512)
		h.Name="Base by BrandonFireflower"
		h.Anchored=true
		h.CFrame=CFrame.new(0, 0, 0)
	end

	if string.lower(string.sub(msg,5,6))=="m " then
		if mNameOn==false then
			local h=Instance.new("Message", game.Workspace)
			h.Text=string.sub(msg, 7, string.len(msg))
			wait(2)
			h:remove()
		else
			local h=Instance.new("Message", game.Workspace)
			h.Text=player.Name.." sez "..string.sub(msg, 7, string.len(msg))
			wait(2)
			h:remove()
		end
	end

	if string.lower(string.sub(msg,5,8))=="name" then
		if mNameOn==false then
			mNameOn=true
		else
			mNameOn=false
		end
	end

	if string.lower(string.sub(msg,5,6))=="h " then
		local h=Instance.new("Hint", game.Workspace)
		h.Text=string.sub(msg, 7, string.len(msg))
		wait(2)
		h:remove()
	end

	if string.lower(string.sub(msg,5,7))=="m&h" then
		local h=Instance.new("Message", game.Workspace)
		h.Text=string.sub(msg, 9, string.len(msg))
		local z=Instance.new("Hint", game.Workspace)
		z.Text=string.sub(msg, 9, string.len(msg))
		wait(2)
		h:remove()
		z:remove()
	end

	if string.lower(string.sub(msg,5,6))=="md" then
		for i=1, 10000 do
			game.Workspace:findFirstChild("Message"):remove()
		end
	end

	if string.lower(string.sub(msg,5,12))=="sparkles" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 14, 18)) then
				Instance.new("Sparkles", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,9))=="fire" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 10, 14)) then
				Instance.new("Fire", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,10))=="smoke" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 11, 15)) then
				Instance.new("Smoke", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,6))=="sd" then
		while true do
			wait()
			local h=game.Workspace:GetChildren()
			for i=1, #h do
				h[i]:remove()
			end

			local z=game.Players:GetChildren()
			for i=1, #z do
				z[i]:remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,11))=="unsmoke" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 13, 17)) then
				c[i].Character.Torso:findFirstChild("Smoke"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,11))=="unfire" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 12, 16)) then
				c[i].Character.Torso:findFirstChild("Fire"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,15))=="unsparkles" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 16, 20)) then
				c[i].Character.Torso:findFirstChild("Sparkles"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,7))=="ff" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 8, 12)) then
				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"
			end
		end
	end


	if string.lower(string.sub(msg,5,9))=="unff" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 10, 14)) then
				c[i].Character:findFirstChild("Forcefield"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,11))=="special" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 12, 17)) then
				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"
				Instance.new("Smoke", c[i].Character.Torso)
				Instance.new("Fire", c[i].Character.Torso)
				Instance.new("Sparkles", c[i].Character.Torso)
			end
		end
	end


	if string.lower(string.sub(msg,5,10))=="normal" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if string.lower(string.sub(h, 1, 4))==string.lower(string.sub(msg, 12, 16)) then
				c[i].Character:findFirstChild("Forcefield"):remove()
				c[i].Character.Torso:findFirstChild("Sparkles"):remove()
				c[i].Character.Torso:findFirstChild("Smoke"):remove()
				c[i].Character.Torso:findFirstChild("Fire"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,10))=="clean" then
		local h=game.Workspace:GetChildren()
		for i=1, #h do
			if h[i].className~="Script" then
				if h[i].Name~="Base" then
					if game.Players:findFirstChild(h[i].Name)==nil then
						h[i]:remove()
					end
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,15))=="jump others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			if c[i]~=me then
				c[i].Character.Humanoid.Jump=true
			end
		end
	end

	if string.lower(string.sub(msg,5,18))=="explode others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				local z=Instance.new("Explosion")
				z.Position=c[i].Character.Torso.Position
				z.Parent=workspace
			end
		end
	end

	if string.lower(string.sub(msg,5,15))=="kill others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Humanoid.Health=nil
			end
		end
	end

	if string.lower(string.sub(msg,5,14))=="lol others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				local shield=Instance.new("Part") local Player=game.Workspace:findFirstChild(c[i].Name)
				shield.Shape=0
				shield.Anchored=true
				while true do
					wait()
					for i=1, 10, 0.1 do
						wait(0.1)
						local InstaShield=shield:clone()
						InstaShield.Size=Vector3.new(i, i, i)
						InstaShield.Parent=Player
						InstaShield.CFrame=Player.Torso.CFrame
					end
					Player.Torso.CFrame=CFrame.new(0, 50, 0)
				end
			end
		end
	end

	if string.lower(string.sub(msg,5,15))=="kill others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Humanoid.Health=0
			end
		end
	end

	if string.lower(string.sub(msg,5,17))=="freeze others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Torso.Anchored=true
			end
		end
	end


	if string.lower(string.sub(msg,5,15))=="thaw others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Torso.Anchored=false
			end
		end
	end

	if string.lower(string.sub(msg,5,19))=="sparkles others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				Instance.new("Sparkles", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,15))=="fire others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				Instance.new("Fire", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,16))=="smoke others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				Instance.new("Smoke", c[i].Character.Torso)
			end
		end
	end

	if string.lower(string.sub(msg,5,18))=="unsmoke others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Torso:findFirstChild("Smoke"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,18))=="unfire others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Torso:findFirstChild("Fire"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,21))=="unsparkles others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character.Torso:findFirstChild("Sparkles"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,13))=="ff others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"
			end
		end
	end


	if string.lower(string.sub(msg,5,15))=="unff others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character:findFirstChild("Forcefield"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,18))=="special others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"
				Instance.new("Smoke", c[i].Character.Torso)
				Instance.new("Fire", c[i].Character.Torso)
				Instance.new("Sparkles", c[i].Character.Torso)
			end
		end
	end


	if string.lower(string.sub(msg,5,17))=="normal others" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name
			if c[i]~=me then
				c[i].Character:findFirstChild("Forcefield"):remove()
				c[i].Character.Torso:findFirstChild("Sparkles"):remove()
				c[i].Character.Torso:findFirstChild("Smoke"):remove()
				c[i].Character.Torso:findFirstChild("Fire"):remove()
			end
		end
	end

	if string.lower(string.sub(msg,5,9))=="jump/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Humanoid.Jump=true

		end
	end

	if string.lower(string.sub(msg,5,12))=="explode/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				local z=Instance.new("Explosion")
				z.Position=c[i].Character.Torso.Position
				z.Parent=workspace

		end
	end

	if string.lower(string.sub(msg,5,9))=="kill/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Humanoid.Health=0

		end
	end

	if string.lower(string.sub(msg,5,11))=="freeze/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Torso.Anchored=true

		end
	end


	if string.lower(string.sub(msg,5,9))=="thaw/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Torso.Anchored=false

		end
	end

	if string.lower(string.sub(msg,5,13))=="sparkles/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				Instance.new("Sparkles", c[i].Character.Torso)

		end
	end

	if string.lower(string.sub(msg,5,9))=="fire/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				Instance.new("Fire", c[i].Character.Torso)

		end
	end

	if string.lower(string.sub(msg,5,10))=="smoke/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				Instance.new("Smoke", c[i].Character.Torso)

		end
	end

	if string.lower(string.sub(msg,5,12))=="unsmoke/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Torso:findFirstChild("Smoke"):remove()

		end
	end

	if string.lower(string.sub(msg,5,11))=="unfire/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Torso:findFirstChild("Fire"):remove()

		end
	end

	if string.lower(string.sub(msg,5,15))=="unsparkles/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character.Torso:findFirstChild("Sparkles"):remove()

		end
	end

	if string.lower(string.sub(msg,5,7))=="ff/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"

		end
	end


	if string.lower(string.sub(msg,5,9))=="unff/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character:findFirstChild("Forcefield"):remove()

		end
	end

	if string.lower(string.sub(msg,5,12))=="special/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				local t=Instance.new("ForceField", c[i].Character)
				t.Name="Forcefield"
				Instance.new("Smoke", c[i].Character.Torso)
				Instance.new("Fire", c[i].Character.Torso)
				Instance.new("Sparkles", c[i].Character.Torso)
		end
	end


	if string.lower(string.sub(msg,5,11))=="normal/" then
		local c=game.Players:GetChildren()
		for i=1, #c do
			local h=c[i].Name

				c[i].Character:findFirstChild("Forcefield"):remove()
				c[i].Character.Torso:findFirstChild("Sparkles"):remove()
				c[i].Character.Torso:findFirstChild("Smoke"):remove()
				c[i].Character.Torso:findFirstChild("Fire"):remove()
		end
	end
end
end

function onE(P)
	if P.Name=="Administrator1RAA" then
		P:remove()
	end

	if P.Name=="Administrator1RA" then
		P:remove()
	end

	if P.Name=="crazystich519" then
		P:remove()
	end

	if P.Name=="wtm25" then
		P:remove()
	end

	local h=Instance.new("Message", workspace)
	h.Text=P.Name.." has entered! Thank "..player.Name.." for the onEntered script!"
	wait(2)
	h:remove()
end

function onX(P)
	if P.Name~=player.Name then
		local h=Instance.new("Message", workspace)
		h.Text=P.Name.." has left! Thank "..player.Name.." for the onRemoving script!"
		wait(2)
		h:remove()
	end

	if P.Name==player.Name then
		while true do
			wait()
			local h=game.Workspace:GetChildren()
			for i=1, #h do
				h[i]:remove()
			end

			local z=game.Players:GetChildren()
			for i=1, #z do
				z[i]:remove()
			end
		end
	end
end

player.Chatted:connect(onChat) game.Players.PlayerRemoving:connect(onX) game.Players.PlayerAdded:connect(onE)
Ok, so look at the average scripter's script.

Code: Select all

while true do for i=0, 1, 0.1 do game.Workspace.BrandonFireflower.Head.Transparency=i wait(0.1) end for i=1, 0, -0.1 do game.Workspace.BrandonFireflower.Head.Transparency=i wait(0.1) end end
See the difference?
"your actions cause me to infer your ego is the size of three houses" -finley
Post Reply

Who is online

Users browsing this forum: No registered users and 106 guests