## What would the code looks like if I want turn on/off the spotlight from script?

Requests or suggestions for new features
sergio_ledzep
Posts: 2
Joined: 17 Nov 2017, 15:53

### What would the code looks like if I want turn on/off the spotlight from script?

I have a custom UI and I just want to know what would the code looks like if i want turn on/off the spotlights every time that I press a button.

coppelia
Site Admin
Posts: 7918
Joined: 14 Dec 2012, 00:25

### Re: What would the code looks like if I want turn on/off the spotlight from script?

Hello,

try with:

Code: Select all

simSetLightParameters(lightObjectHandle,state)
where bit 0 of state represents the on/off flag.

Cheers

sergio_ledzep
Posts: 2
Joined: 17 Nov 2017, 15:53

### Re: What would the code looks like if I want turn on/off the spotlight from script?

I have this, but it still does not working

if (buttonID == 15) then
simSetLightParameters("the name of my spotlight ,0)
end

coppelia
Site Admin
Posts: 7918
Joined: 14 Dec 2012, 00:25

### Re: What would the code looks like if I want turn on/off the spotlight from script?

Your code doesn't say anything. What is buttonID???

Cheers