Jump to content

SetFloat Gui no work on Panel


 Share

Recommended Posts

myPanel:SetString("radius",9") -- Not Workd.
myButton:SetString("radius,9)  -- Yes Work.

image.png.0d4b4db8883967af5f89b2336dcafbb9.png

 

The only way it works is to modify the values directly in the lua panel file.

 

function Script:Draw(x,y,width,height)	
	local gui = self.widget:GetGUI()
	local pos = self.widget:GetPosition(true)
	local sz = self.widget:GetSize(true)
	local scale = self.widget:GetGUI():GetScale()
	
	if self.widget:GetParent()==nil then
		gui:SetColor(0,0,0,0)
		gui:Clear()
	end

	gui:SetColor(self.backgroundcolor.r,self.backgroundcolor.g,self.backgroundcolor.b,self.backgroundcolor.a)
	--gui:SetColor(self.color.background.r,self.color.background.g,self.color.background.b,self.color.background.a)
	gui:DrawRect(pos.x,pos.y,sz.width,sz.height,0,4.5) --self.radius <<<<<<<<<<<<<<<<<<<<<<<<
	
	--Draw image if present
	local image = self.widget:GetImage()
	if image~=nil then
		local imgsz = image:GetSize()
		imgsz.x = imgsz.x * scale
		imgsz.y = imgsz.y * scale
		gui:SetColor(self.color.foreground.r,self.color.foreground.g,self.color.foreground.b,self.color.foreground.a)
		--gui:DrawImage(image,pos.x+(sz.x-imgsz.x)/2,pos.y+(sz.y-imgsz.y)/2,imgsz.x,imgsz.y)
		gui:DrawImage(image,pos.x,pos.y,sz.x,sz.y)
	end
	
	--Draw border
	--if self.border then
		gui:SetColor(self.color.border.r,self.color.border.g,self.color.border.b,self.color.border.a)
		--gui:SetColor(0,1,0,1)
		gui:DrawRect(pos.x,pos.y,sz.width,sz.height,1,4.5) --self.radius <<<<<<<<<<<<<<<<<<<<<<<
	--end
	
	--gui:SetColor(1,0,0)
	--gui:DrawRect(pos.x,pos.y,sz.width,sz.height,1)
	--gui:DrawRect(pos.x+self.indent/2*scale,pos.y+self.indent/2*scale,sz.width-self.indent*scale,sz.height-self.indent*scale,1)
	--gui:DrawRect(pos.x,pos.y,sz.width,sz.height,1)	
end

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

myPanel:SetBool("radius",9") -- Not Workd.
myButton:SetBool("radus,9)  -- Yes Work.

 

Look at the syntax you have there. You'll always need matching double quotes. Your first one you have a double quote at the end of the 9 but no matching one for that. Your second one you only have 1 double quote.

  • Haha 1
Link to comment
Share on other sites

Okay, if I misspelled here, but it still doesn't work. 

 

myPanel:SetBool("radius",9") -- Not Workd.
myButton:SetBool("radius,9)  -- Yes Work.

 

myPanel:SetFloat("radius",9") -- Not Workd.
myButton:SetFloat("radius,9)  -- Yes Work.

 

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

What does SetBool() do? It seems odd to me that you'd pass multiple 2 values, a string and a number to something called SetBool().

 

  • SetBool(string name, boolean value)

 

Your second value should be a true/false not a number. Maybe you're looking for SetInt() (if that exists)

 

 

[EDIT]

Looks like there is a SetFloat() that you may be looking for.

  • Sad 1
Link to comment
Share on other sites

This is crazy, when I try to pass to English what I want to express in Spanish.

If evidently it is SetFloat.

With SetFloat, I can take variables from widgets, and change certain values before variables.

But it certainly doesn't work. :( on Panel.

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

they all definitly work no doubt about it.

are you certain that the variable you try to read/write actually exists in the widget script??

i assume you are looking for.

widget:SetFloat("radius", 2);
widget:GetFloat("radius");


REMEMBER !!!
call widget:Redraw() when you change a variable's value.
often you would think "hey this does not work" while it usually does work but is not updated yet ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...