Entity movecodes and Render/Showpage
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
glambourine

Okay--so I'm coding lots of fun little cut scenes for my Gruedorf project. And sometimes it seems like Render and Showpage process my entities and copy them to the screen, and sometimes it seems like they don't.

Here's a sample of code where they don't work:


wait(50);

EntityMove(e_sheriff, "u5l0w30r0w30l0w30r0w30d0");

while(entitymoving(e_sheriff)) {
Render();
ShowPage();
}


And here's a sample of code where they do:

wait(25);

EntityMove(e_sheriff, "l0w30r0w30l0w30r0w30u0");
while(entitymoving(e_sheriff)) {
Render();
ShowPage();
}


The entitymoving function just returns entity.movecode[whatever] == 3, which should be if the entity is currently moving according to a script, right? I can't think of any better way to check whether an entity is moving or not.

But thing is: I don't see why the game copies the entity's state to the screen as expected in the second example and not in the first. There's this weird lurch in the entity's movement in the first example and I just don't see any reason for that to be happening. The v3 logs show that it's going into the loop each time, but for some reason the loop isn't doing what it must the first time? Does it have something to do with my wait() function (which pretty much just waits according to the passed number of timer ticks?)

Is there some weird thing about movecodes and ShowPage() that I just don't know? About 75% of the time this code works fine, but there's that other 25% of horrible lurching--does anyone know what's going on? I can not fathom this madness, William

Posted on 2008-06-27 01:14:04

resident

Well, I'm surprised the second one works since it begins with an number rather than a command ("l0w30r0w30l0w30r0w30u0").#

Not having much movecode experience myself, I'd try passing every direction in separately and seeing what VERGE is trying to do with every command. i.e.

wait(50);



EntityMove(e_sheriff, "u5l0");
log("u510");


while(entitymoving(e_sheriff)) {

Render();

ShowPage();

}

EntityMove(e_sheriff, "w30");
log("30");


while(entitymoving(e_sheriff)) {

Render();

ShowPage();

}

and so on. Between V3.log and what's happening on screen, you should wind up with a better idea of where the problem might be.

Posted on 2008-06-27 07:52:45

mcgrue

Actually, there's a very handy vc function we coded in Sully Chronicles that we do just this with.

Originally in vc\util\general.vc, by Zip:


// Waits until an entity has finished its movecode
// -Zip
void WaitForEntity( int wait_entity ){

// Just incase we get stuck somewhere, set a timeout
int timeout = timer + 1000;

// While the entity is still doing stuff
while (entity.movecode[wait_entity])
{
Render(); // Render the map
ShowPage(); // Display to screen

// If they've got stuck
if (timeout < timer) {

// Stop the entity
EntityStop(wait_entity);
// Notify you so you can fix your code
ErrorHandler("Timeout for entity number "+str(wait_entity)); // Zip: Muxed for sully
}
}
}


Lots of useful stuff in that file in general :)

-b

Posted on 2008-06-27 16:22:27

glambourine

res: that's an L!

mcgrue: Except for the "timeout" stuff that's basically what my entitymoving function does. I did change the return value from entity.movecode[i] == 3 to just returning entity.movecode and it seems like it works for a couple of the weirder spots. There's still a problem when I want to have characters move a single step for some reason--I guess because the movecode string gets cleared before it's fully processed or something? I don't know--probably I can just ad hoc it by having a showpage loop with a certain delay before or after the entitymoving loops, experimenting around with it.

Anyway. Thanks very much, everyone!

Posted on 2008-06-27 20:12:54

resident

Well, it certainly makes a bit more sense when read that way :)

Posted on 2008-06-28 03:18:25


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.