Okay so in roblox i have been trying to make a flickering light but it doesn't seem work. So i have tried finding what my error in line one is but.. it doesn't seem to work and i can't seem to find it.
while true do
math.randomseed(tick())
local Brightness = math.random(0.1 , 1)
local Light = script.Parent
local SpotLight = Light.SL
local RandomPause = (math.random(0.5 , 5))
wait(RandomPause)
SpotLight.Brightness = Brightness
wait (RandomPause)
SpotLight.Brightness = Brightness
end
Insert a spotlight into the part
Insert this script into the part:
local spotlight = game.Workspace.Light.SpotLight
while true do
spotLight.Enabled = true
wait(2)
spotLight.Enabled = false
wait(0.1)
spotLight.Enabled = true
wait(0.3)
spotLight.Enabled = false
wait(0.5)
end
You can edit the "wait(time)" as you wish to speed up the flickering or slow it down.
Related
In Excel VBA change option in the HTML select tag, I used the following code to change options within the <select> tag:
For Each objOption In objIE.Document.GetElementsByTagName("table")(0).GetElementsByTagName("td")(tdNode).GetElementsByClassName("txt_input1")(0).Options
If objOption.Value = SelQ Then
objOption.Selected = True
objIE.Document.GetElementsByTagName("table")(0).GetElementsByTagName("td")(tdNode).GetElementsByClassName("txt_input1")(0).OnChange
Else
objOption.Selected = False
End If
Next
This seems to work for web sites with nested <table> tags, but the web site was updated without the tags, so, to compensate for finding the selected option, I used this:
For Each objOption In objIE.Document.getElementById("frmProduction").elements.namedItem("WQ").Options
If objOption.Value = strVal Then
objOption.Selected = True
objIE.Document.getElementById("frmProduction").elements.namedItem("WQ").onchange
Exit For
Else
objOption.Selected = False
End If
Next
This is giving me the following error: Run-time error '5002': Application-defined or object-defined error
I used the above solution because it worked in another Internet Explorer application that used <frames> tags, so I modified it a little:
objIE.document.frames("DemographicsIFrame").document.GetElementByID("DropDownPayerID").value = PayerID
objIE.document.frames("DemographicsIFrame").document.GetElementByID("DropDownPayerID").onchange
I've tried to get around it with no success. I can get the selected option to change, but that's it. It won't update the page with required info related to the selected option. In the example above, that's what the onchange event was used for...to change the page contents after the PayerID was updated.
Any advice on how to make this work?
We were actually able to come up with a solution:
For Each objOption In objIE.document.getElementById("frmProduction").elements.namedItem("WQ").Options
If objOption.Value = strVal Then
objOption.Selected = True
Set evtFiroz = objIE.document.createEvent("HTMLEvents")
evtFiroz.initEvent "change", False, True
objIE.document.getElementById("WQ").dispatchEvent evtFiroz
Exit For
Else
objOption.Selected = False
End If
Next
Is it possible to totally remove the background color and the border of a toggle button in Access? As shown in the Imgur picture, I'd like to remove the grey-ish background and the border of the button totally so I'd keep the white icon (that list icon) only. Would that even be possible?
I am sure this is related to your other question at MS Access ToggleButton Picture change.
Use an Image control with embedded image and this code (note declaration of public variable in header):
Option Compare Database
Option Explicit
Public booMenu
Sub timeout(duration_ms As Double)
Dim Start_Time As Double
Start_Time = Timer
Do
DoEvents
Loop Until (Timer - Start_Time) >= duration_ms
End Sub
Private Sub Image5_Click()
Dim x As Integer
booMenu = Not booMenu
Me.Menu.Visible = True
Do
DoEvents
Me.Menu.Width = Me.Menu.Width + IIf(booMenu, 200, -200)
Me.Menu.Left = Me.Menu.Left - IIf(booMenu, 200, -200)
Me.Image5.Left = Me.Image5.Left - IIf(booMenu, 200, -200)
timeout (0.01)
x = x + 1
Loop Until x = 10
Me.Menu.Visible = booMenu
End Sub
I managed to find (kind of) a solution to this. The solution was to change the following parameters:
Use Theme = No;
BackColor = Form Color;
Pressed Back Color = Form Color
Eventually, it provides an effect very similar to the one that I was trying to achieve.
This question isn't particularly technical, it's more theoretical.
I'm doing the "project queue" thing in Access that I think we all do from time to time. We've got several steps to go through. I'm hiding buttons that don't make sense in a given step and adding a star to the most relevant tab. For example, if I have been assigned development of a project, the "move to production" button is hidden and disabled because I need to go through testing before I can move the project to production. I also rename the development tab to Development* to queue me to that.
Everything was hardcoded in VBA and it still can be but it's getting longer and uglier to maintain. I'm wondering if someone has a best practice or just general suggestion. I had 6 statuses but I'm going to 12 and feel like it's time to think about doing this better.
When a button is clicked you get a code block like this:
Private Sub AssignScoping_Click()
Me.RequestStatus.Enabled = True
Me.RequestStatus = "Scoping"
Me.RequestStatus.Enabled = False
End Sub
Each button just assigns a different text value to the RequestStatus field which drives the rest of the logic which looks like this:
Private Sub setButtonAvailability()
Select Case Me.RequestStatus
Case Null
Me.PlaceInQueue.Visible = True
Me.PlaceInQueue.Enabled = True
Me.AssignScoping.Visible = False
Me.AssignScoping.Enabled = False
Me.AssignDevelopment.Visible = False
Me.AssignDevelopment.Enabled = False
Me.AssignTesting.Visible = False
Me.AssignTesting.Enabled = False
Me.AssignProduction.Visible = False
Me.AssignProduction.Enabled = False
Me.AssignAutomation.Visible = False
Me.AssignAutomation.Enabled = False
Me.Tabs.Pages("Intake").Caption = "Intake" & "*"
Me.Tabs.Pages("Scoping").Caption = "Scoping"
Me.Tabs.Pages("Development").Caption = "Development"
Me.Tabs.Pages("Testing").Caption = "Testing"
Me.Tabs.Pages("Production").Caption = "Production"
Me.Tabs.Pages("Automation").Caption = "Automation"
...
Case Else
Me.PlaceInQueue.Visible = True
Me.PlaceInQueue.Enabled = True
Me.AssignScoping.Visible = True
Me.AssignScoping.Enabled = True
Me.AssignDevelopment.Visible = True
Me.AssignDevelopment.Enabled = True
Me.AssignTesting.Visible = True
Me.AssignTesting.Enabled = True
Me.AssignProduction.Visible = True
Me.AssignProduction.Enabled = True
Me.AssignAutomation.Visible = True
Me.AssignAutomation.Enabled = True
Me.Tabs.Pages("Intake").Caption = "Intake"
Me.Tabs.Pages("Scoping").Caption = "Scoping"
Me.Tabs.Pages("Development").Caption = "Development"
Me.Tabs.Pages("Testing").Caption = "Testing"
Me.Tabs.Pages("Production").Caption = "Production"
Me.Tabs.Pages("Automation").Caption = "Automation"
End Select
End Sub
I figure there are a ton of options including putting some of the controlling info in a table for just that purpose but thought I'd bounce it off your collective noggins for suggestions as I tend to work in isolation at my job and I don't always think of the best way to do something, just the way I can do it right now.
Textbox and combobox can employ Conditional Formatting rules to set enabled/disabled state.
Doesn't matter what approach is taken, still have to 'touch' each control to set its property. One approach is to generically loop through controls collection without having to explicitly reference each control by name and set the Enabled or Visible properties according to some criteria. Use of control's Tag property might be helpful. Example:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCommandButton Then
ctl.Visible = ctl.Tag = Me.RequestStatus
End If
Next ctl
Another approach is to give controls similar name, like btnProj1, btnProj2, etc. Then loop could be limited to that set of controls:
For x = 1 to 10
Me.Controls("btnProj" & x).Visible = Me.Controls("btnProj" & x).Tag = Me.RequestStatus
Next
If you set a control not visible, why bother with the Enabled property?
I need a timer to increment with rising edge on the GPIO pin. I can't find any code example doing just that.
I have a digital Hall sensor which sense a magnet approaching the sensor and I want to count how many times the magnet came around the sensor. The sensor gives positive pulse when magnet goes around. I want to use this pulse to increment counter value.
I know how to set the timer into basic up-counting mode (with internal clock).
TIM_TimeBaseInitTypeDef TIM_BaseStruct;
/* Configure TIMER4*/
TIM_BaseStruct.TIM_Prescaler = 40000;
TIM_BaseStruct.TIM_CounterMode = TIM_CounterMode_Up;
TIM_BaseStruct.TIM_Period = 500;
TIM_BaseStruct.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_BaseStruct.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM4, &TIM_BaseStruct);
TIM_Cmd(TIM4, ENABLE);
And this works, but I need to switch the clock to external signal. How do I do that?
EDIT
After rewriting code from Guillaume Michel's answer with the use of functions defined in library I'm using (I do not use HAL library), I came up with a code
TIM_TimeBaseInitTypeDef timer4;
timer4.TIM_Prescaler=0;
timer4.TIM_CounterMode=TIM_CounterMode_Up;
timer4.TIM_Period=5;
timer4.TIM_ClockDivision=TIM_CKD_DIV1;
TIM_TimeBaseInit(TIM4,&timer4);
TIM_ETRClockMode2Config(TIM4,TIM_ExtTRGPSC_DIV2,TIM_ExtTRGPolarity_NonInverted, 0);
TIM_SelectSlaveMode(TIM4,TIM_SlaveMode_Reset);
TIM_SelectMasterSlaveMode(TIM4, TIM_MasterSlaveMode_Disable);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_PinAFConfig(GPIOD,GPIO_Pin_13,GPIO_AF_TIM4);
GPIO_Init(GPIOD, &GPIO_InitStructure);
This is compilable, yet non-working code. I set the timer period to 5 and I set interrupt to toggle LED every time timer counts all the way up, but LED never lights on no matter how many times i run magnet around sensor. Is there some visible mistake? What can I do to make it work?
You could try to connect the hall sensor output on a GPIO of you STM32F411 and set this GPIO as clock of the timer. This could look like:
TIM_HandleTypeDef htim4;
TIM_ClockConfigTypeDef sClockSourceConfig;
TIM_MasterConfigTypeDef sMasterConfig;
htim4.Instance = TIM4;
htim4.Init.Prescaler = 0;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 65535;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&htim4);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_ETRMODE2;
sClockSourceConfig.ClockPolarity = TIM_CLOCKPOLARITY_NONINVERTED;
sClockSourceConfig.ClockPrescaler = TIM_CLOCKPRESCALER_DIV1;
sClockSourceConfig.ClockFilter = 0;
HAL_TIM_ConfigClockSource(&htim4, &sClockSourceConfig);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig);
The GPIO is set up like this:
//Set PE0 as TIM4_ETR
__HAL_RCC_GPIOE_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
Anyone know how to turn animation off in dojox.widget.Dialog? I love the modal dialog, but want it to pop up immediately, rather than the painfully slow animate on that it does. I tried turning off the apparent animation controls, but it still animates. Also looked into the src code, but didn't see any smoking guns for a configuration option. here's the sample invocation:
id = "dojoModalWrapper"
jsId = "dojoModalWrapper"
dojoType = "dojox.widget.Dialog"
showTitle = "false"
dimensions = "[678,370]"
sizeDuration = 0
easing = null
style = "background-color: #e86d0d; display:none;"
Why not use dijit.Dialog?