Hookretrace() and while() statements...
Displaying 1-10 of 10 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Tralu

Is it possible to make HookRetrace() and While() to exist in complete harmony? Or will the while statement always pause the hookretrace? I'm using v2.6, if anyone cares.



It has always been the prerogative of children and half-wits to point out that the emperor has no clothes. But the half-wit remains a half-wit, and the emperor remains and emperor. -Dream

Posted on 2001-11-04 16:06:52

CypherAlmasy

Well, it depends on what you're doing within the while statement. Obviously, the longer it takes for the while loop to execute, the more time there's going to be between retraces, but as long as the loop is relatively small, it shouldn't cause the HookRetraced script to stop completely. I'm using several for loops in one of my HookRetraced scripts, and all it does is slow down the frame rate; I'd assume it would be the same with a while loop, since they're really equivalent. Maybe I misunderstand the question. I do that a lot. :-)

CypherAlmasy



"If any of you step out of line, I'll promise to kill you in the name of T.G. Cid too. I'm watching you. Especially you over there, elfy." -Orlandu

Posted on 2001-11-04 19:47:58

Tralu

Hmm... this is all that's in my while statement:
strline[0]=one;
Updatecontrols();
And nothing loops at all. -_-



It has always been the prerogative of children and half-wits to point out that the emperor has no clothes. But the half-wit remains a half-wit, and the emperor remains and emperor. -Dream

Posted on 2001-11-04 19:54:55

CypherAlmasy

This may be a long shot, but did you remember to add the HookRetrace to the render string in MapEd? If you don't, the script will never execute. Not once.

CypherAlmasy



"If any of you step out of line, I'll promise to kill you in the name of T.G. Cid too. I'm watching you. Especially you over there, elfy." -Orlandu

Posted on 2001-11-04 22:05:53

vecna

Also, I wouldn't put UpdateControls() inside a while loop inside a HookRetrace. Once per retrace is enough, I think. ^_^

-vecna



Posted on 2001-11-05 01:14:11

Tralu

The HookRetrace definitely works, but not with the while statement looping around. And getting rid of UpdateControls() in thw while loop but not in the Hookretrace doesn't allow me to use the keyboard.
OK, as a certain precaution, I've added the simple code that I've added to my new game thus far.

//The HookRetrace Loop
void startgame()
{
log("begin!");
rectfill(0,0,640,480,RGB(1,1,1));
rectfill(0,0,640,480,RGB(255,255,255));
rectfill(2,2,638,478,RGB(200,200,200));
rectfill(3,3,637,477,RGB(0,0,50));
rect(50,36,591,444,RGB(200,200,200));
rect(51,37,590,443,RGB(0,0,0));
Tcopysprite(54,40,533,400,house);
/* if( random(100)=1 !blink)
{blink=1; timer=0;}
if(blink)
{
if(timer10 && timer14 && timer19 && timer27 && timer32 && timer36)
{blink=0;}
timer++;

}
*/
if(!blink)
{tcopysprite(30, 105, 200, 450, girl);}
Setlucent(2);
Calclucent(200);
rectfill(54,370,583, 480, RGB(0,25,100));
Setlucent(0);
rect(54,370,583, 480, RGB(255,255,255));
rect(55,372,582, 479, RGB(255,255,255));
rect(55,373,581, 478, RGB(200,200,200));
// statmenu();
GotoXy(59, 375);
printstring(font, strline[0]);
showpage();
updatecontrols();
if(b2)
{
exit("Goodbye...sucker.");
}


}

//The while loop...text not finished
void text(string one, string two, string three)
{

while(!b1)
{
strline[0]=one;
}

}

This is kind of a stripped down version of it, but it looks like it should work, right? Without the while statement, the Hookretrace works fine, but the HookRetrace won't even loop once during the while statement. Help, anyone?



It has always been the prerogative of children and half-wits to point out that the emperor has no clothes. But the half-wit remains a half-wit, and the emperor remains and emperor. -Dream

Posted on 2001-11-05 14:35:47

CypherAlmasy

I may just be shooting my mouth off again, but I'm gonna do it anyway. If I interpret this code correctly (and I'm probably not), you're making a simple text box program. If that's the case, you may want to change the while loop to an if statement. I know that sounds weird, but I look at that while loop and think of it as unneccessary. I mean, you could add this to your HookRetrace script:

if(!b1)
{
strline[0] = one;
}

. . . and that test will execute everytime the screen refreshes as long as b1 isn't down. If you add a loop to that, it's kind of overkill; you're making it loop twice. Then, while it's sitting there waiting for b1 to be pressed, the rest of the HookRetrace script isn't doing anything because it's waiting to exit the loop. I hope I'm helping you and not confusing you, or just talking about the wrong subject. I do that a lot. ^_^

CypherAlmasy



"If any of you step out of line, I'll promise to kill you in the name of T.G. Cid too. I'm watching you. Especially you over there, elfy." -Orlandu

Posted on 2001-11-05 15:53:07

Tralu

hmm...that definitely won't help. I'm trying to recall that while statement as an event from the map, separate from the hookretrace. Hm...



It has always been the prerogative of children and half-wits to point out that the emperor has no clothes. But the half-wit remains a half-wit, and the emperor remains and emperor. -Dream

Posted on 2001-11-05 19:04:08

CypherAlmasy

I see. . . perhaps, then, you can edit the HookRetrace functions and stuff like so:

//Add to HookRetraced function
if(flag)
{
if(mb == 1)
{
//Do yo' thing
if(done)
{
flag = 0;
}
}
}

//Make text function look like this
void text(string var, string var 2, string etc.)
{
flag = 1;
}

Also, you might try adding ShowPage() to your while loop. That should force a retrace, and it might work. There may be an easier way, but I like to try to work around problems, rather than through them. ^_^




"If any of you step out of line, I'll promise to kill you in the name of T.G. Cid too. I'm watching you. Especially you over there, elfy." -Orlandu

Posted on 2001-11-05 20:22:59

Tralu

It's not the while loop's fault. I've found out that V2.6 tends to go through the whole event before running the Hookretrace. So I've decided to dump the whole idea of running the game through HookRetrace. -_-



It has always been the prerogative of children and half-wits to point out that the emperor has no clothes. But the half-wit remains a half-wit, and the emperor remains and emperor. -Dream

Posted on 2001-11-06 20:46:02


Displaying 1-10 of 10 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.