2 registered members (AndrewAMD, alibaba),
1,184
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Jump Action Crash
[Re: mschoenhals]
#452189
06/05/15 20:00
06/05/15 20:00
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
okay looks like you found what "appears" to me like a coding mistake in the template script . I quickly looked it over and saw that the jump_handle was localy defined inside the t_player action but never assigned to a sound wich was called in another function t_player_jump . to fix this (don't know if we are allowed but I fixed mine) : open up t_player.c file in SED , the file is located inside of your gamestudio installation folder \include sub folder . once opened inside SED , scroll down to the "action t_player() " function , then change :
var current_height = 0, jump_handle;
to then go to line 40 and add this as a global variable: now scroll down to "function t_player_jump ()" then change from :
snd_play(shooter_jump,70,0);
to :
jump_handle=snd_play (shooter_jump,70,0);
save t_player.c , now publish your project and test enjoy.
Compulsive compiler
|
|
|
Re: Jump Action Crash
[Re: Wjbender]
#452194
06/05/15 22:50
06/05/15 22:50
|
Joined: Aug 2013
Posts: 101
mschoenhals
OP
Member
|
OP
Member
Joined: Aug 2013
Posts: 101
|
Wow! That works! Thank you programming god! How is it that you went about figuring it out? Any tips for a beginning coder? Thanks again.
|
|
|
Re: Jump Action Crash
[Re: mschoenhals]
#452199
06/06/15 01:08
06/06/15 01:08
|
Malice
Unregistered
|
Malice
Unregistered
|
Wow! That works! Thank you programming god! high praise indeed
|
|
|
Re: Jump Action Crash
[Re: ]
#452200
06/06/15 07:39
06/06/15 07:39
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
like they say "follow the money trail" , so you follow the program flow and trace the problem. .
yeah I am no programming god , I am sure I wil require your help one day.
but..
to legitimately answer your question , and I am sure you went about it the same manner as I , since it happens when pressing space ,we simply jump to where space is handled , if the problem is not easy to spot and you do not understand the problem then , you can resort to trial and error like : start commenting code out piece by piece and publish everytime until you figure out which code area holds the mistake , then you simply can trace whatever is used in that area (variables/functions/pointers) to find the cause , if things get really hairy you can always use printf or DEBUG_VAR to help out , the point being to always check any values / pointers / functions / variables in the area you have traced .
if however you understand the language and engine better , you can approach the problem more methodical , I basically just jumped to the space handled code and looked at everything used there , then I quickly spotted that the sound handle was an uninitialised variable , since it needed to be assigned to something I traced to where the sound was to be used and connected the dots ..
other than that , all I can really advice you on is ,that every mistake is an opportunity to learn , mistakes wil teach you more than anyone can ever teach you , why ? Because one's you have gone through hell to find out what went wrong , you won't forget it because you actually learned to understand the mistake .
there wil come a time when bug hunting becomes fun , but all of us go through this mistakes even after years of coding , the simplest of mistakes have at times given me headaches like adding 2 ";;" at the end of a line ,almost impossible to spot at times .
with SED my advice is to do as my signature states , compile often (publish often) after code additions / changes , and as always check values/pointers before using them with "if clauses" or functions/macros you have written to do it for you.
Last edited by Wjbender; 06/06/15 10:29.
Compulsive compiler
|
|
|
Re: Jump Action Crash
[Re: Wjbender]
#452202
06/06/15 10:51
06/06/15 10:51
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
and another heads up : in that same file "pragma_path" is used , and that statement is not supported in the published version .
Compulsive compiler
|
|
|
Re: Jump Action Crash
[Re: Wjbender]
#452208
06/06/15 15:34
06/06/15 15:34
|
Joined: Aug 2013
Posts: 101
mschoenhals
OP
Member
|
OP
Member
Joined: Aug 2013
Posts: 101
|
Thanks Wjbender! A great response. Yeah, I was trying to comment out the code and could isolate the issue. I need more work on my programming; it's taking some time. Thanks again for your help.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|