Post new topic    
Liquid Metal Slime
Send private message
Script Issue: Put Hero + Loop 
 PostMon Jul 05, 2010 10:29 pm
Send private message Reply with quote
Put Hero works fine when I try to move the main character, but problems arise when anybody else tries to move.

I tried a simple test case just to figure out where the problem is.

Code:

plotscript, walk, begin
add hero (1)

variable (x)
while (x << 100)
do(
put hero (1, hero pixel x (1) + 1, hero pixel y (1))
increment (x)
show value (hero pixel x (1))
wait (1)
)

end


I've replaced "1" with "0" for the hero party positions, and it'll move the leader just fine.

In the example above, the hero will move once and only once.
Also, its location is never updated.
The Shown Value is always the same (its initial one).

So it seems like the function is fine, but the hero location (for any hero other than the leader) is never updated.

I'd appreciate any fixes or alternate methods.
The best one so far is just using NPC's (Their locations update just fine) or slices in place of the heroes.

edit: Using latest nightlies
Liquid Metal King Slime
Send private message
 
 PostMon Jul 05, 2010 10:33 pm
Send private message Reply with quote
Sounds like you have not done "suspend caterpillar". Moving the non-leader heroes won't work unless you do.

It is okay to suspend caterpillar, move the heroes, and then immediately resume caterpillar without waiting.
Liquid Metal Slime
Send private message
 
 PostMon Jul 05, 2010 10:43 pm
Send private message Reply with quote
James Paige wrote:
Sounds like you have not done "suspend caterpillar". Moving the non-leader heroes won't work unless you do.

It is okay to suspend caterpillar, move the heroes, and then immediately resume caterpillar without waiting.


Tried to run this just now:

Code:

plotscript, walk, begin
suspend catapillar
add hero (1)

variable (x)
while (x << 100)
do(
put hero (1, hero pixel x (1) + 1, hero pixel y (1))
increment (x)
show value (hero pixel x (1))
wait (1)
)

end

*Used both 'pillar variants

I can't say the results are any different Sad

Have also tried:
Code:

plotscript, walk, begin
suspend catapillar
add hero (1)

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

put hero (1, hero pixel x (1) + 8, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

end


The hero will move to the right 4 pixels, then 4 more, then back 4.
Liquid Metal King Slime
Send private message
 
 PostTue Jul 06, 2010 12:01 am
Send private message Reply with quote
Twinconclusive wrote:
James Paige wrote:
Sounds like you have not done "suspend caterpillar". Moving the non-leader heroes won't work unless you do.

It is okay to suspend caterpillar, move the heroes, and then immediately resume caterpillar without waiting.


Tried to run this just now:

Code:

plotscript, walk, begin
suspend catapillar
add hero (1)

variable (x)
while (x << 100)
do(
put hero (1, hero pixel x (1) + 1, hero pixel y (1))
increment (x)
show value (hero pixel x (1))
wait (1)
)

end

*Used both 'pillar variants

I can't say the results are any different Sad

Have also tried:
Code:

plotscript, walk, begin
suspend catapillar
add hero (1)

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

put hero (1, hero pixel x (1) + 8, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
show value (hero pixel x (1))
wait for key (anykey)

end


The hero will move to the right 4 pixels, then 4 more, then back 4.


So the second script works?? If that's the case then maybe your problem is the variable x. maybe's it's being set higher then 100 somewhere else and so the script is doing nothing. I suggest using a different variable.

I'm also confused as to what your script is suppose to do. It seems to put your 2nd hero to the right 1 pixel and leave it there for 100 ticks. There's gotta be better ways of writing that.
Liquid Metal Slime
Send private message
 
 PostTue Jul 06, 2010 12:57 am
Send private message Reply with quote
The second script is broken such that,

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
The Hero will move 4 pixels to the right.

put hero (1, hero pixel x (1) + 8, hero pixel y (1))
The Hero will move 4 pixels to the right.

put hero (1, hero pixel x (1) + 4, hero pixel y (1))
The Hero will move 4 pixels to the left.

The script shown (first) is the only script used for this test case.

The first script is a loop that should move the hero one pixel to the right with each tick for a total of 100 ticks, but the hero's position is never updated so it doesn't move any further than a single pixel.
Liquid Metal Slime
Send private message
 
 PostTue Jul 06, 2010 2:27 am
Send private message Reply with quote
I could be wrong, but it doesn't look like you're storing any values in the pixel movement, so the script thinks it's supposed to increment by one from zero every time.

I think that's why your second example moves left 4 pixels when you go from 8 back to 4. I don't think you're ever storing the new variable, so it goes back to the base. In this case, it's moving from 0 to 4, then 0 to 8 (giving the illusion of moving 4 to the right, and then 0 to 4, giving the illusion of moving back 4 from position 8).

Try storing the hero's position in an updating variable and see if that works.

I'll usually do:

plotscript, walk, begin
suspend catapillar
add hero (1)

variable (x,hx)
while (x << 100)
set variable (hx,hero pixel x (1))
set variable (hy,hero pixel y (1))

do(
put hero (1, hx,hy)
increment (x)
increment (hx)
show value (hero pixel x (1))
wait (1)
)

end

See if that does what you're trying to accomplish.
Place Obligatory Signature Here
Liquid Metal King Slime
Send private message
 
 PostTue Jul 06, 2010 2:46 am
Send private message Reply with quote
I agree with pepsi ranger
Liquid Metal Slime
Send private message
 
 PostTue Jul 06, 2010 11:32 am
Send private message Reply with quote
Oh thank you, that'll do it V
Metal Slime
Send private message
 
 PostTue Jul 06, 2010 3:04 pm
Send private message Reply with quote
I disagree. Sorry, but from all I've read so far this definitely sounds like a bug within the engine itself. "Hero pixel x" should read and return the current pixel placement of the given hero, without the need for storing the value in a variable first. Furthermore, it works correctly for hero 0, apparently. Twinconclusive, I think you ought to post this in Bugzilla with your test case.
I am Srime
Liquid Metal King Slime
Send private message
 
 PostTue Jul 06, 2010 4:45 pm
Send private message Reply with quote
msw188 wrote:
I disagree. Sorry, but from all I've read so far this definitely sounds like a bug within the engine itself. "Hero pixel x" should read and return the current pixel placement of the given hero, without the need for storing the value in a variable first. Furthermore, it works correctly for hero 0, apparently. Twinconclusive, I think you ought to post this in Bugzilla with your test case.


It's not really a bug so much as a coding choice. You see, the heroes are suppose to be in the group with the leader. That's where they are stored. This way, the command bit; hero pixel x (1) + 4; doesn't permanently displace the hero.
Remember, there's what the script wants to do, and then there's what the engine defaults want to do. You have to make them play nicely.
Metal Slime
Send private message
 
 PostWed Jul 07, 2010 1:47 am
Send private message Reply with quote
Sorry to sound stubborn, but I still disagree. This is what "Suspend Caterpillar" is supposed to be all about - overriding the engine's desire to make the heroes follow the leader. In the end it is certainly James' decision, but I think this should be 'fixed'.
I am Srime
Display posts from previous: