Jump to content




Need help with a variable


  • You cannot reply to this topic
5 replies to this topic

#1 Divion

  • New Members
  • 2 posts

Posted 29 June 2013 - 04:34 PM

Hi, this is one of my first programs, so i dont really know a lot of CC other that some of the wiki contents.
I want to be able to say a function followed by a variable, where the variable is a string that completes the rs.setBundledOutput("back", here goes the variable). So i created the 3 variables i need, but i dont know how to say to the command to fill the space there.
--Variables
local move = "colors.white"
local deploy = "colors.black"
local bb = "colors.cyan"
--Function
function pulse()
  rs.setBundledOutput("back", --i need the variable here
  sleep(0.5)
  rs.setBundledOutput("back", 0)
end
--Program
function MainProg
  count = 0
  while true do
	count = count + 1
	pulse(move)
	sleep(4)
	pulse(deploy)
	sleep(27)
	pulse(bb)
	sleep(1)
	print ("Finished : "..count)
end
MainProg()
Sorry for my bad english, sometimes its hard to write what i want.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 30 June 2013 - 01:17 AM

Split into new topic.

If you want to have all three lines on at once, you'd want to use colors.combine to put them together:

rs.setBundledOutput("back", colors.combine(move, deploy, bb))


#3 M4sh3dP0t4t03

  • Members
  • 255 posts
  • LocationGermany

Posted 30 June 2013 - 06:23 AM

I think the thing he wants is
 function pulse(color)
  rs.setBundledOutput("back", color)
  sleep(0.5)
  rs.setBundledOutput("back", 0)
end


#4 Apfeldstrudel

  • Members
  • 161 posts

Posted 30 June 2013 - 08:03 AM

I think the thing he wants is

rs.setBundledOutput("back",bb,true)


#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 30 June 2013 - 12:55 PM

View PostKingOfNoobs, on 30 June 2013 - 06:23 AM, said:

I think the thing he wants is
 function pulse(color)
  rs.setBundledOutput("back", color)
  sleep(0.5)
  rs.setBundledOutput("back", 0)
end

Yeah, looks like that's probably what he needs. I skimmed the code a bit quicker than usual. :P

View PostXyexs, on 30 June 2013 - 08:03 AM, said:

I think the thing he wants is

rs.setBundledOutput("back",bb,true)

That's not how you use the setBundledOutput function. Please don't add incorrect information.

#6 Divion

  • New Members
  • 2 posts

Posted 30 June 2013 - 03:59 PM

Thank you, it was what i was looking :D





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users