|
|
|
06-17-2017, 09:37 AM
|
#1
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
reateam reascript - gui examples, just work Development environment opened?
per example, this script: https://github.com/ReaTeam/ReaScript...w_At_Mouse.lua
it runs when i have Development Environment Opened and click run, but not when i click in the toolbar bar button i created for this or when i press a Keyboard Shortcut.
What am i doing wrong?
Thanks!
|
|
|
06-17-2017, 02:16 PM
|
#2
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
I don't know why it works in the IDE, but when ran standalone the window disappears as soon as it can because the script finishes its execution.
Add this bit of code to increase the lifespan of the script so that it only finishes when the window is closed:
Code:
function loop()
if gfx.getchar() >= 0 then
reaper.defer(loop)
end
end
reaper.defer(loop)
|
|
|
06-18-2017, 07:52 AM
|
#3
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
thanks man! that makes it work altho i don't know exactly what those instruction are making.
can you tell me what : gfx.getchar does? and what reaper.defer(loop) means?
Thanks a lot!
|
|
|
06-18-2017, 01:38 PM
|
#4
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Have you looked at the API documentation?
In summary: - getchar returns -1 when the window is closed, 0 if no key is pressed and a positive number otherwise.
- defer runs the given function on the next internal timer tick (EDIT: 30-50Hz). It also disables the undo point that running a script usually creates.
Last edited by cfillion; 06-19-2017 at 04:29 PM.
|
|
|
06-18-2017, 02:03 PM
|
#5
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
i searched but didn't find , i think i just googled tho. All makes more sense now. Thank you for that! all good peace!
|
|
|
06-18-2017, 02:11 PM
|
#6
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
The documentation can be accessed straight from REAPER: Help > ReaScript documentation. It's way more up to date than anything you'll find online since this one is generated specifically for your current version of REAPER and loaded extensions.
X-Raym also frequently updates a prettier one here: https://www.extremraym.com/cloud/reascript-doc/.
Last edited by cfillion; 06-18-2017 at 02:18 PM.
|
|
|
06-19-2017, 03:53 PM
|
#7
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
That example script is mine - it closes the window right away because it's not meant to be a full script. It's just a demo for getting the window position.
|
|
|
06-19-2017, 05:21 PM
|
#8
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,812
|
Quote:
Originally Posted by cfillion
The documentation can be accessed straight from REAPER: Help > ReaScript documentation. It's way more up to date than anything you'll find online since this one is generated specifically for your current version of REAPER and loaded extensions.
X-Raym also frequently updates a prettier one here: https://www.extremraym.com/cloud/reascript-doc/.
|
Quote:
Originally Posted by Lokasenna
That example script is mine - it closes the window right away because it's not meant to be a full script. It's just a demo for getting the window position.
|
Thank you both for everything. : )
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:55 PM.
|