2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Script Crash
[Re: Yashas]
#411560
11/17/12 17:26
11/17/12 17:26
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
can you post a small example of your code, please?
@Uhrwerk, then I did something wrong when I tried it...
POTATO-MAN saves the day! - Random
|
|
|
Re: Script Crash
[Re: Yashas]
#411563
11/17/12 17:27
11/17/12 17:27
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Now we have to look into our crystal balls to give you advide unless you post the code fragment that causes this error. As a general rule, Yashas, if you've got a problem please post the error message if any and the code that is causing the problem. In the best case it is a SSCCEE. The more information you provide, the more likely someone can help you. http://sscce.org/
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Script Crash
[Re: Uhrwerk]
#411605
11/18/12 05:28
11/18/12 05:28
|
Joined: Nov 2011
Posts: 139 India
Yashas
OP
Member
|
OP
Member
Joined: Nov 2011
Posts: 139
India
|
void SpeedRun_GoGoGo ()
{
BMAP * SpeedRun_TEMP;
int SpeedRun_i = integer(random(6));
int SpeedRun_Row = 1;
int SpeedRun_Trys = 0;
int SpeedRun_Wrong = 0;
SpeedRun_TEMP = SpeedRun_Shapes[SpeedRun_i];
SpeedRun_Previous = SpeedRun_i;
pan_setwindow(SpeedRun_ControlsPlaying,1,200,150,200,200,SpeedRun_TEMP,200,200);
pan_setstring(SpeedRun_ControlsPlaying,4,-100,-100,"",str_create(""));
pan_setbutton(SpeedRun_ControlsPlaying,1,0,-100,-100,bmap_create("button1.tga"),bmap_create("button1.tga"),bmap_create("button1.tga"),NULL,NULL,NULL,NULL);
*SpeedRun_Time = 60;
SetTimer (SpeedRun_Time,1,NULL);
while(SpeedRun_Time != 0)
{
if(key_cur)//Same
{
if(SpeedRun_Previous == SpeedRun_i)
{
//Correct
//AddUserXP(2);
SpeedRun_Score += 5 * SpeedRun_Row;
SpeedRun_Row++;
}
else
{
//Wrong
}
}
else if (key_cul) //Not Same
{
if(SpeedRun_Previous == SpeedRun_i)
{
//Wrong
}
else
{
//Correct
}
}
wait(1);
}
}
When I compile: Error in 'line 1899: illegal indirection < *SpeedRun_Time = 60; > .. 0.214 sec Error compiling LINTEX.DATA.BANK.GAMES.SPEEDRUN.C Error E355: Startup Failure - any key to abort
|
|
|
Re: Script Crash
[Re: Yashas]
#411627
11/18/12 12:27
11/18/12 12:27
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
It does not do that on my end, when I add the required global variables. Please post your declaration of SpeedRun_Time.
Btw. once again there is a memory leak in your code. Every time you call this function three bitmaps vanish into the void.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Script Crash
[Re: Yashas]
#411643
11/18/12 14:55
11/18/12 14:55
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
What is temp? If you're talking about SpeedRun_TEMP i doubt that this is a good idea. This will remove random bitmaps from the array.
I was talking about the three "bmap_create("button1.tga")". It's not only that you create three bitmaps where one would suffice, it's also that you create these bitmaps every time the function gets called. After calling it 1.000 times you will have 997 unused bitmaps in memory that are irrevertably lost and cannot be freed by anything else than closing the engine.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Script Crash
[Re: Uhrwerk]
#411651
11/18/12 15:30
11/18/12 15:30
|
Joined: Nov 2011
Posts: 139 India
Yashas
OP
Member
|
OP
Member
Joined: Nov 2011
Posts: 139
India
|
I used to get Invalid Argument when I used to set the bitmap paramter in pan_setbutton to NULL.Hence I did bmap_create. So what if I create a BMAP * abc = bmap_createblack (..) and use it as parameters(Actually I want to hide that button  ) and sys_free at the end of the game
|
|
|
Re: Script Crash
[Re: Yashas]
#411653
11/18/12 15:38
11/18/12 15:38
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
It does not matter if you create them statically or with bmap_create or bmap_createblack. The point is that you should create the bitmap ONE time. As long as you don't want to get rid of it prematurely you don't even need to free it at the end of the game. The engine will take care of that for you.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|