2024-03-23 01:22 AM - last edited on 2024-09-26 01:13 PM by Doreena Deng
Hi,
I have a list of hotspots that I thought could be cleaned up with an array.
When implemented
unID = 1
HOTSPOT X1, 0, 0, unID, Len1, 1+128 :unID=unID+1 !Point
HOTSPOT X1, 0+Len1, 0, unID, Len1, 2 :unID=unID+1 !Move
HOTSPOT X1, 0-1, 0, -unID, Len1, 3 :unID=unID+1 !Ref
within a loop using an array, the hotspots all turn to static hotspots.
Here is the code that works in the standard way (repeat for next 12 hotspots):
Here is the code using a loop that produces static hotspots instead of dynamic:
! Note, X[i] and Len[i] are declared arrays with defined values:
unID = 1
FOR i = 1 TO 12
HOTSPOT X[i], 0, 0, unID, Len[i], 1+128 :unID=unID+1 !Point
HOTSPOT X[i], 0+Len[i], 0, unID, Len[i], 2 :unID=unID+1 !Move
HOTSPOT X[i], 0-1, 0, -unID, Len[i], 3 :unID=unID+1 !Ref
Next i
What could be changed in the code to make the hotspots return to being dynamic within the loop?
Any help most welcome.
Many thanks, Matt
Solved! Go to Solution.
2024-03-23 04:13 AM
2024-03-25 02:41 AM
If you did not replace your placed object after you changed your parameter to an array it will not work properly as the old objects values are not defined properly, it is not looking for an array. The same thing happens when you change the size of an array. When changing a parameter to an array type, I will usually delete the parameter, save it which will brick any existing objects, then recreate the parameter. You can also initiallise the array at the start of your script or in the parameter script then go and redefine each paramter value through a loop. Required if you are dynamically changing the array size.
Ling.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2024-03-23 04:13 AM
2024-03-24 09:38 PM
Hi Toper,
Thank you for your coding! I am super perplexed as your code works fine for me also when separated from my object. When I try the code in my object, it returns a simple static hotspot no matter what options of code I try using in the array. I read here of a similar issue:
Their solution of adding a glob_modpar statement, is confusing. I am unsure what it would change? Maybe it is needed to cause the code to run again. Any thoughs most welcome.
Many thanks, Matt
2024-03-25 02:41 AM
If you did not replace your placed object after you changed your parameter to an array it will not work properly as the old objects values are not defined properly, it is not looking for an array. The same thing happens when you change the size of an array. When changing a parameter to an array type, I will usually delete the parameter, save it which will brick any existing objects, then recreate the parameter. You can also initiallise the array at the start of your script or in the parameter script then go and redefine each paramter value through a loop. Required if you are dynamically changing the array size.
Ling.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2024-03-27 08:08 PM
Hi Ling,
Thank you for your guidance. I am still unsuccessful after all this time with this particular set of array hotspots. Very confusing as to why it doesn't work in the object. I am happy to use the basic multi-line method for now as the object is working. Wishing you the best, Matt
2024-03-28 02:22 AM
Did you initiallise your arrays?
DIM X[ ]
DIM Len[ ]
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |