failing to get part of this script to run ONCE!
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-21 05:39 AM
2011-06-21
05:39 AM
My object is an external cladding screen consisting of a steel frame and automatically generated (random within user set parameters) vertical timber slats on the outside.
I have the graphical editing working so that I can stretch the frame and more slats generate - nice. Now I have created dynamic hotspots for users to edit individual slats. They show up ok but moving them generates no result BECAUSE it is constantly recalculating the slat positions (Funny how they all stay the same when I've used a RND function to generate them!... another time). So I've introduced a variable called Regen which when = 0 will run the slat calculation and put a line in the slat calculation which makes Regen = 1, thinking that this will stop the calculation running.
It refuses to work. Regen is somehow reset to zero on each attempted edit so the dynamic hotspots have no effect.
Yes Regen is uninitialized.
I must be missing something basic. Any help?
8 REPLIES 8

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-21 06:03 AM
2011-06-21
06:03 AM
Take a look at how I handle the lines for the hangers in the simple closet object here. I think this will resolve your issue.
Rabbit Hole
Rabbit Hole
Erich
AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-21 06:19 AM
2011-06-21
06:19 AM
Thanks Erich, But I don't see it yet.
It looks to me like your random line generator for the 2d clothes representation runs every time.
An equivalent to my situation would be if you then introduced dynamic hotspots to allow user editing of the 2d clothes lines. If your random routine keeps running it would not allow a successful user edit - my problem. How do you get it to do the first run of random generation and then allow user editing?
It looks to me like your random line generator for the 2d clothes representation runs every time.
An equivalent to my situation would be if you then introduced dynamic hotspots to allow user editing of the 2d clothes lines. If your random routine keeps running it would not allow a successful user edit - my problem. How do you get it to do the first run of random generation and then allow user editing?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-21 10:43 AM
2011-06-21
10:43 AM
Angry wrote:When you set
I've introduced a variable called Regen which when = 0 will run the slat calculation and put a line in the slat calculation which makes Regen = 1, thinking that this will stop the calculation running.
It refuses to work. Regen is somehow reset to zero on each attempted edit so the dynamic hotspots have no effect.
parameters regen = 1
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-28 09:39 AM
2011-06-28
09:39 AM
Thanks Ralph,
I am using the "parameters Regen = 1" statement
The code looks like this:
(3d script)
-------------------
If Regen = 0 then
gosub 2000 ! recalculate slat lengths
Regen = 1
Parameters Regen = 1
endif
-------------------
Perhaps the 'parameters' instruction has a limitation on which script it works in?
I am using the "parameters Regen = 1" statement
The code looks like this:
(3d script)
-------------------
If Regen = 0 then
gosub 2000 ! recalculate slat lengths
Regen = 1
Parameters Regen = 1
endif
-------------------
Perhaps the 'parameters' instruction has a limitation on which script it works in?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-28 09:42 AM
2011-06-28
09:42 AM
Angry wrote:Yes, it does. It will only take effect during some kind of editing operation, i.e. when the use is changing the settings or stretching in 2D/3D.
I am using the "parameters Regen = 1" statement
Perhaps the 'parameters' instruction has a limitation on which script it works in?
Ralph Wessel BArch
Central Innovation
Central Innovation

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-06-28 10:34 AM
2011-06-28
10:34 AM
Angry wrote:Yes it will only work in the Parameter or Master scripts - not the 2D or 3D scripts.
Perhaps the 'parameters' instruction has a limitation on which script it works in?
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-07-09 08:37 PM
2011-07-09
08:37 PM
Barry wrote:Not quite true. YouAngry wrote:Yes it will only work in the Parameter or Master scripts - not the 2D or 3D scripts.
Perhaps the 'parameters' instruction has a limitation on which script it works in?
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-09-07 12:16 PM
2011-09-07
12:16 PM
Follow-up:
It was working all along!!
The issues were:
The PRINT alert I had in the Parameter script to tell me the global-modpar had been detected didn't work - seems PRINT will not work in the parameter script.
And ACs static RND results were giving exactly the same 'random' numbers for my slat lengths!! (the results are only new when you place a new instance if the object). Got my own 'random' function now.
So the whole thing was working, just not changing or giving me my print alert!
So that's all fixed. Now on to the next vexing problem with the dynamic hotspots re-setting all my array values to zero?? - new post time.
It was working all along!!
The issues were:
The PRINT alert I had in the Parameter script to tell me the global-modpar had been detected didn't work - seems PRINT will not work in the parameter script.
And ACs static RND results were giving exactly the same 'random' numbers for my slat lengths!! (the results are only new when you place a new instance if the object). Got my own 'random' function now.
So the whole thing was working, just not changing or giving me my print alert!
So that's all fixed. Now on to the next vexing problem with the dynamic hotspots re-setting all my array values to zero?? - new post time.