PDA

View Full Version : Question on con coding


WhyteTyger
06-07-2001, 12:02 AM
I've been working with a piece of useractor code that needs to check if Duke is moving, but ifp pwalking does not seem to trigger the actor. Is this primitive only usable within the APLAYER structure or does it need to be written differently when being called from another actor?

Mblackwell
06-07-2001, 12:39 AM
ifp pwalking, AND ifp prunning should probably both be tested. You may be in run mode.

WhyteTyger
06-07-2001, 01:10 AM
Thanks for the suggestion. I probably should have put both checks in the code, but I had a feeling that wasn't my problem... and I was right. At the moment, I have the actor set to play a "test sound" when the code is activated. So far nothing.

Bruce Hamilton
06-07-2001, 06:46 AM
It would be helpful if you could post the snippet of code in question... Might be something as simple as a missing set of { }.

WhyteTyger
06-07-2001, 05:47 PM
Heh, I can see your point. No, the sound itself is defined and coded right... I'm sure it's the code itself that isn't being called... I don't have access to the exact code right now so I'll try to do this from memory....

useractor notenemy WEAK
fall
ifcansee
ifpdistl 3072
ifp pwalking
sound MYSOUND
else ifp prunning
sound MYSOUND
enda

I'm attempting to have an actor play a sound if the player is a certain distance away and is running or walking. If the code is sloppy or (as I fear) incorrect, I am still learning and appreciate any feedback on this.

Mblackwell
06-07-2001, 06:51 PM

cyborg
06-08-2001, 12:34 AM
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by WhyteTyger:
Thanks for the suggestion. I probably should have put both checks in the code, but I had a feeling that wasn't my problem... and I was right. At the moment, I have the actor set to play a "test sound" when the code is activated. So far nothing.<HR></BLOCKQUOTE>

Use quotes - otherwise I'll assume first that you screwed up the sound, second that you screwed up the actual code that's supposed to activate it.

WhyteTyger
06-08-2001, 03:16 PM
Not to be rude or start a flame war, Cyborg, but I did say I didn't have access to the exact code... I know my C+ programming and the syntax involved. I was a little rushed with the last post.

Thanks for the reply, MBlackwell, though it still doesn't seem to be working... I rewrote the actor code on a newly extracted Game con and everything is fine until the code checks for ifp prunning or ifp pwalking. Still not sure what's happening.

Mblackwell
06-08-2001, 04:15 PM
The problem is a typo in my code

I put "ifp running" instead of "ifp prunning". But that shouldn't have been a hard mistake to figure out.

WhyteTyger
06-08-2001, 04:50 PM
Yes, I noticed the typo in the code and corrected it when I did the rewrite (before the last post).

At this point, the code still does not work. I am trying some other solutions as well.

Mblackwell
06-08-2001, 09:38 PM
Yer sounds should be 11Khz or lower, and 8bit Mono. Using "Sound Recorder" to convert it doesn't work. At this point I'd have to say something like that is the problem.

cyborg
06-09-2001, 12:14 AM
Why oh why can't people understand the simple concept of curly braces?

WhyteTyger
06-09-2001, 02:17 AM
That's what I thought too... but the sounds play fine outside the code. So, I tried using quotes to check the if statements and make sure they were being executed... and they aren't... It's like that portion of the code is being bypassed. Very strange.

Bruce Hamilton
06-09-2001, 06:37 AM
I think the problem may be the order of your if statements... You've got it checking the player distance after checking if player can see the target, try checking the distance first.

Mblackwell
06-09-2001, 07:18 AM
Most likely it'd be able to see the player b4 the player is a given distance away (like, put the thing in an open room or whatnot). But, have you played the sounds inside Duke, with some DIFFERENT code. Just put the actor's code as "soundonce MYSOUND" and commment the rest out for now. If the sound doesn't play.... the problem is yer sound.

WhyteTyger
06-09-2001, 02:09 PM
Yes, the sounds actually do play fine within Duke. I appreciate all the help and suggestions you guys have given me, but it's really a moot point now.

After a marathon night of coding, I actually got it to work in EDuke exactly how I wanted it to (compared with about a week of Atomic coding, heh.)