cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic hotspots in loop and array

Hi !

I need small help in coding. I'm not very good in it so sorry if the question is rather simple.

I need to make lines witch are drawn by a loop "FOR 1 TO 5" where each line lenght can be controled seperately by its own hotspot.
I managed to make it work so all hotspots show but each of the hostposts control line length of ALL the lines.... but thats not the goal.


hsid=101
FOR p=1 TO 5
HOTSPOT2 	0, 	0, 		    hsid, lenght, 1+128		: hsid=hsid+1
HOTSPOT2 	0, 	lenght, 	hsid, lenght, 2			: hsid=hsid+1
HOTSPOT2 	0, 	-1, 		   hsid, lenght, 3			: hsid=hsid+1
line2 0,0,0,lenght
add2 3, 0

NEXT p
I suppose I need to make some sort of an array where each "lenght" is different but its seems to be in conflict with the "FOR TO" Loop.

This does not work:
DIM lenght[]
hsid=101
FOR p=1 TO 5
HOTSPOT2 	0, 	0, 				hsid, lenght

, 1+128 : hsid=hsid+1 HOTSPOT2 0, lenght

, hsid, lenght

, 2 : hsid=hsid+1 HOTSPOT2 0, -1, hsid, lenght

, 3 : hsid=hsid+1 line2 0,0,0,lenght

add2 3, 0 NEXT p

Any ideas how to get hotspots work seperately in a loop ?

Przechwytywanie.JPG
4 Replies 4
Erich
Booster
Take a look at the 2D script for my framing object. It does exactly this. There is a loop statement in the body of the script with the hotspot controls set in a subroutine.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Anonymous
Not applicable
Erich, thank so much !

It works !

BTW Nice object, thumbs up.
Anonymous
Not applicable
This is how its done:

hsid=hsid+1

i=1

FOR p=1 TO 5 

	GOSUB 100   !!!Hotspots
	line2 0,0,0,lenght
	add2 3, 0
	i=i+1

NEXT p 

END

100:   !!!Hotspots
HOTSPOT2    0,    0,       		hsid, lenght, 1+128     : hsid=hsid+1 
HOTSPOT2    0,    lenght,    hsid, lenght, 2         : hsid=hsid+1 
HOTSPOT2    0,    -1,      		hsid, lenght, 3         : hsid=hsid+1 
RETURN 
The key is that the "lenght" parameter requires in the "parameters" a "array values" in a column:
Erich
Booster
philips wrote:
Erich, thank so much !

It works !

BTW Nice object, thumbs up.
Thanks. It has it's uses.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!