HookRetrace()
Displaying 1-9 of 9 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
CypherAlmasy

Okay. . . here goes:

I have decided to attempt to redo my mouse controlling scripts so that they run off of a HookRetrace-d script, because they look crappy with a while-loop, mostly because of synch errors I think could be solved if I knew that all of this stuff happened every retrace. Unfortunately, it doesn't seem to work. I'm getting a VC Stack Overflow error. What I'm asking is this: is it possible to do TOO much during a HookRetrace-d script, and if so, how much is too much? Also, is this the problem I'm having, or am I jumping to conclusions? Well, you get it.

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-10-24 18:35:03

vecna

Well, I'm not exactly sure what version of V2 you're using. But the answer should be no. It's very possible to do too much in a HookTimer and I general discourage people from using it, but HookRetrace is generally pretty safe, if your code takes too long, your framerate simply drops.

However, if you were to call Render() then your HookRetrace would go into an infinite recursive loop. You might be doing that.... or something else. Idunno. Lemme know if that's not the problem. ^_^

-vecna



Posted on 2001-10-25 01:59:29

andy

v2k and up disable Render() while running hooked scripts. It will simply do nothing at all.



"Ignorance is its own reward" -- Proverb

Posted on 2001-10-25 08:13:53

CypherAlmasy

I guess I should have mentioned the version, huh? Oops. I'm using the WinV2 beta, and everything seems to be working fine as far as my code goes. I commented out the Render statement that I was using in my old loop, and that seemed to fix it. Now I've just got to figure out why it's not changing pointers. . . ::sigh:: My work is never done. Thanks for your help!

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-10-25 15:14:08

CypherAlmasy

Okay, I've sat here and looked over this code again and again and I have no idea what's wrong with it. Perhaps you guys can help me out. The idea here is to get the mouse pointer graphic to change when it's over certain entities. Unfortunately, it doesn't do this; rather, it remains the same pointer constantly. This leads me to believe that the computer is not recognizing the position of the entities correctly, or something similar. I have included a few choice bits of my code so you can see what I'm trying to do. Help would be much appreciated.

//Initialization of several arrays used to keep track
//of certain entity traits:
entx[screenentnum + 1] = x;
enty[screenentnum + 1] = y;
entpx[screenentnum + 1] = entx[screenentnum + 1] * 16 - xwin;
entpy[screenentnum + 1] = enty[screenentnum + 1] * 16 - ywin;
entpx1[screenentnum + 1] = entpx[screenentnum + 1] - 8;
entpy1[screenentnum + 1] = entpy[screenentnum + 1] - 8;
entpx2[screenentnum + 1] = entpx[screenentnum + 1] + 8;
entpy2[screenentnum + 1] = entpy[screenentnum + 1] + 8;

//Inside the CursorOverEnt function. This branch is
//supposed to return an integer depending on the type
//of ent the cursor is over. I think the problem may
//be in the conditions of the the IF, though if it is
//the reason is beyond me:
if(mx = entpx1[i] && mx = entpy1[i] && my



"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-10-25 20:29:44

CypherAlmasy

Oops. Here's the branch in its entirety:

for (i=1; i= entpx1[i] && mx = entpy1[i] && my



"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-10-25 20:32:14

CypherAlmasy

I don't know why it's not showing the loop/branch. However, the branch's conditions are fairly simple.
If mx is greater than entpx1[i] and less than entpx2[i] AND my is greater than entpy1[i] and less than entpy2[i], then it has a switch for the type of the entity to determine which pointer it returns. I'm sure you can figure out what I'm saying here. ^_^

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-10-25 20:37:30

vecna

A few notes:
entity.tx / entity.ty return the entity coordinates in tiles, while entity.x and entity.y return it in pixels. It's not clear from the example, but if you're reading entity.x and multiplying by 16 that might have something to do with it.

Also, in winv2 writing to entity.tx/ty is completely ignored, and reading just takes .x and .y and divides it by 16. So it's really suggested you just use entity.x and entity.y.

Lastly, if you're using numentsonscreen or whatever.. that doesn't really work yet. As I said, the entity support in beta 1.0 is definitely a bit undercooked ^_^ Look for a new release this weekend probably.

Also, we've been working on some technologies for the "non-compatible" edition of winv2. It'll be pretty cool, but I really gotta make the compatible-version better first ^_^

-vecna



Posted on 2001-10-26 00:42:01

CypherAlmasy

Something really screwy is happening with my game, and it explains why nothing works right. Let me explain. As I said, I set up several arrays and variables to keep track of the entities on the screen. I have a function that spawns an entity and sends the various traits of the entity to the arrays where they are stored and the variable I use as a kind of master index pointer is incremented (hence the numentsonscreen and entpx[] stuff from my last post). However, in order to test if the values were wrong, I put a few GotoXY/PrintString statements in the mouse function. When it printed the values, I was surprised to find that ALL of them were 0, even the ones that are set by really simple assignment statements, like this one:

enttype[numentsonscreen] = type

. . .where type is a parameter passed to the function. How much easier does it get? So, I know now why the pointers aren't changing over the entity: it thinks that it's at (0,0). The strange thing is, the pointer doesn't change at (0,0) either! I have no idea what's wrong. Does this kind of problem ring a bell, or do I need to include more actual code so you can see what I'm doing?

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-10-26 18:57:54


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