Brendzt 0 Posted December 6, 2020 (edited) I grabbed an example, It has all these functions to just to use the Random function. Is there away to put this into a group so I can collapse/hide it so I don't have to scroll so far while typing more code? HotKeySet("{F1}", "RunFunc") While (1) Sleep(100) WEnd Func RunFunc() Local $aFuncs[3] = [camera1, camera2, camera3] $aFuncs[Random(0, 2, 1)]() EndFunc ;==>RunFunc Func camera1() MsgBox(0, 0, "camera1") EndFunc ;==>camera1 Func camera2() MsgBox(0, 0, "camera2") EndFunc ;==>camera2 Func camera3() MsgBox(0, 0, "camera3") EndFunc ;==>camera3 Because I do see an option just to collapse each Function, but I want to mass collapse this whole section Edited December 6, 2020 by Brendzt Share this post Link to post Share on other sites
Melba23 3,496 Posted December 6, 2020 Brendzt, Use the SciTE #region...#endregion directives - details are in the SciTE help file. M23 2 Brendzt and Atrax27 reacted to this Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
Atrax27 1 Posted December 6, 2020 HotKeySet("{F1}", "RunFunc") #Region runfunc While (1) Sleep(100) WEnd Func RunFunc() Local $aFuncs[3] = [camera1, camera2, camera3] $aFuncs[Random(0, 2, 1)]() EndFunc ;==>RunFunc #endregion #Region camera1 Func camera1() MsgBox(0, 0, "camera1") EndFunc ;==>camera1 #endregion #Region camera2 Func camera2() MsgBox(0, 0, "camera2") EndFunc ;==>camera2 #endregion #Region camera3 Func camera3() MsgBox(0, 0, "camera3") EndFunc ;==>camera3 #endregion 1 Brendzt reacted to this Share this post Link to post Share on other sites
Brendzt 0 Posted December 6, 2020 @Atrax27 @Melba23 Thank you! Share this post Link to post Share on other sites
Melba23 3,496 Posted December 6, 2020 Atrax27, Functions are automatically collapsable, so a #region...#endregion directive serves no useful purpose placed around an Func...EndFunc pairing. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
Brendzt 0 Posted December 7, 2020 (edited) @Melba23 I had another question, I saw you on the example post that I grabbed. Just to clarify in the " $aFuncs[Random(0, 2, 1)]() if I changed that to only have (0,2) or if I had a total of calling 5 functions and I wanted all of them called randomly I would changed that to (0,5)? Edited December 7, 2020 by Brendzt Share this post Link to post Share on other sites
GokAy 60 Posted December 7, 2020 (edited) Hey, If you read the function page it would help a lot. Random ( [Min = 0 [, Max = 1 [, Flag = 0]]] ) Parameters Min [optional] The smallest number to be generated. The default is 0. Max [optional] The largest number to be generated. The default is 1. Flag [optional] If this is set to 1 then an integer result will be returned. Default is a floating point number. so in order to get a random integer, in range 1-5 you would need to use random(1,5,1) Edited December 7, 2020 by GokAy 1 Brendzt reacted to this Share this post Link to post Share on other sites