Moving Multiple Hotspots Manually

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Moving Multiple Hotspots Manually

Postby Netjera » Mon Feb 22, 2010 11:14 am

Okay, because Lybero's plugin will only allow you to move items one at a time, and I have to move multiple items at a time, I'm looking into other options.

I've gotten an object to move smoothly, using the following code:


Code: Select all
x = 765
y = y + 150

Action.CreateTimedEvent .1, "Hotspot(1).move x, y", FALSE
Action.SimulateHotspotClick(1)


However, I can't get it to stop. I tried wrapping it in an If..Then like this:

Code: Select all
Bottom = Hotspot(1).top + Hotspot(1).height
x = 765
y = y + 150

Action.CreateTimedEvent .1, "Hotspot(1).move x, y", FALSE
If Bottom <= 341 then Action.SimulateHotspotClick(1)


However, it won't move at all. (Unless I click it manually.) What I want it to do is click itself, causing the move, until it reaches a certain location, then stop clicking itself. I'm assuming there's something wrong with my logic, but I'm not seeing it. (I'm also probably too tired to see it.)

Thanks for looking at it. :)
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States

Postby Lyberodoggy » Mon Feb 22, 2010 2:07 pm

You should "click" it when the frame or event starts using the same command
Action.SimulateHotspotClick(1)
Also, what you did there was pretty good. It's called routine self-call and works like a loop. But you got something wrong. What you want to be timed is the calling, not moving the hotspot. I also modified the code to work without any variables and for any given hotspot, to eliminate the variable problem that also exists in my plugin.

Code: Select all
Hotspot(GetHotspotNumber).move Hotspot(GetHotspotNumber).left, Hotspot(GetHotspotNumber).top+150
Action.CreateTimedEvent .1, "Action.SimulateHotspotClick(GetHotspotNumber)", FALSE
Last edited by Lyberodoggy on Tue Feb 23, 2010 5:33 pm, edited 1 time in total.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Netjera » Mon Feb 22, 2010 10:16 pm

Lyberodoggy wrote:You should "click" it when the frame or event starts using the same command
Action.SimulateHotspotClick(1)


Yeah, I haven't added in automatic calls yet. I was just trying to keep it simple (KISS) until I figured out how to do it. Would not having the call in the frame cause an issue?

Lyberodoggy wrote:Also, what you did there was pretty good. It's called routine self-call and works like a loop. But you got something wrong. What you want to be timed is the calling, not moving the hotspot.

Oh! Is there some reason why this is better?

Lyberodoggy wrote:I also modified the code to work without any variables and for any given hotspot, to eliminate the variable problem that also exists in my plugin.

Code: Select all
Hotspot(GetHotspotNumber).move Hotspot(GetHotspotNumber).width, Hotspot(GetHotspotNumber).height+150
Action.CreateTimedEvent .1, "Action.SimulateHotspotClick(GetHotspotNumber)", FALSE


How does (GetHotspotNumber) work? Do I have to pass the Hotspot number as a parameter somewhere? Or does it grab it automatically? If so, when? On mouse click or frame load, or what? If it's on mouse click, this means I'll have to call every hotspot on frame load, doesn't it?

Thanks a lot!

Oh - I also need to change this part:

Code: Select all
Hotspot(GetHotspotNumber).move Hotspot(GetHotspotNumber).width, Hotspot(GetHotspotNumber).height+150


While the y is a steady fall, the x needs to be at whatever location the hotspot starts at. Remember, I'm trying to make a random number of falling objects that fall at different intervals, and with different speeds (eventually). Right now, I'm working on the simplest case - just get it moving, make it stop.
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States

Postby Lyberodoggy » Tue Feb 23, 2010 5:34 pm

GetHotspotNumber triggers when you click a hotspot. This code I gave you goes directly to every moving hotspot.
Also I had some things wrong in the code just fixed them
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Netjera » Tue Feb 23, 2010 8:50 pm

I did try the code last night, and I noticed something. When I put the timer on the move, the move speed was very quick. However, when I put the timer on the hotspot click, the move speed was VERY slow. (Think, 1/10 of the original speed.)

Could you try it both ways and see if it happens? I finally figured out what was wrong with my original code. It was the twips thing again. I got it working by multiplying by fifteen *sigh* :

Code: Select all
Bottom = Hotspot(1).top + Hotspot(1).height
x = 765
y = y + 150

Action.CreateTimedEvent .1, "Hotspot(1).move x, y", FALSE
If Bottom <= 341*15 then Action.SimulateHotspotClick(1)


Try using that code, and see how fast the hotspot moves. Then use this code:

Code: Select all
Bottom = Hotspot(1).top + Hotspot(1).height
x = 765
y = y + 150

Hotspot(1).move x, y
If Bottom <= 341 * 15 then Action.CreateTimedEvent .1 "ActionSimulateHotspotClick(1)", FALSE


I'm wondering whether this is something related to my laptop. If you have this result as well, what would cause such a difference in speed? The second run seems sluggish and stuttering in comparison to the first.
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States

Postby Lyberodoggy » Tue Feb 23, 2010 11:01 pm

the first code doesn't time the event, that's why I suggested using the second one
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Netjera » Thu Feb 25, 2010 2:56 am

It times the move, which amounts to the same thing doesn't it?

But that doesn't explain why it would slow down the speed of the drop so drastically, does it?
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States

Postby Lyberodoggy » Thu Feb 25, 2010 2:01 pm

It's not the same at all. You see, several timed events moving the hotspot defined pixels per second will occur almost instantly, which means that instead of having

movement 1
pause given time
movement 2
etc

you are going to have

pause given time
movement 1 (short pause that lasts less than .001 second for the code to run next loop) + movement 2 + movement 3 ...
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Netjera » Wed Mar 03, 2010 3:07 pm

I understand the distinction, I'm not sure I understand why it's happening. (Sorry I'm slow.)

Code: Select all
[u]Example One:[/u]
I set a timer for 1 minute
I move a hotspot
I set a timer again for 1 minute


If I understand correctly, one minute from frame load, the hotspot will move, the timer will reset, and one minute after the first hotspot moves, the second hotspot will move.

Code: Select all
[u]Example Two:[/u]
I set a timer for 1 minute
It activates the hotspot
The hotspot moves
I set a timer again for 1 minute


Again, if I understand correctly, one minute from fame load, the hotspot will be clicked. This will activate the hotspot, and it will move. After the hotspot moves, 1 minute later, the hotspot will be clicked again.

I'm not seeing any difference that would account for the slowdown, in my mind, since they both are happening in one minute increments? I'm obviously missing something, though, since I've never known you to be wrong. =D
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States

Postby Lyberodoggy » Wed Mar 03, 2010 7:38 pm

I think we 're not in the same page :(
the .move method just moves the hotspot once. The code I gave you is intended to move one hotspot several times untill it reaches the desired coordinates.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Netjera » Wed Mar 03, 2010 8:51 pm

Lyberodoggy wrote:I think we 're not in the same page :(
the .move method just moves the hotspot once. The code I gave you is intended to move one hotspot several times untill it reaches the desired coordinates.


It is? *blinks* Okay, I'm going to have to go back and pick through it again when I'm less tired. I've been struggling with the multiple move thing (both moving one item multiple times till it reaches a coordinate, and moving multiple items).

*sighs* I'm just not with it lately, I guess. Sorry.
A woman on a mission - a budding artist looking for a place to take root, a builder looking for the right community - I'm looking for a home.
User avatar
Netjera
Frequent Poster
 
Posts: 127
Joined: Sun Jan 24, 2010 8:48 am
Location: United States


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron