PDA

View Full Version : What's with Dink C?



davidi725
08-05-2005, 10:05 PM
I have this huge problem with Dink C: When I get far into a project, it suddenly backfires. For example, the laser in my laser gun stopped working even thought I didn't touch that code. The only thing I touched related doesn't intefere with the item. How can I keep it from randomly backfiring? I'm using Skeleton S.

SimonK
08-08-2005, 11:14 PM
Hard to say without seeing the script - and maybe even the rest of the project? How many global variables do you have? If you run out of variables, scripts stop working properly.

davidi725
08-09-2005, 07:16 PM
Ok, here's the script:

void main( void )
{
script_attach(1000);

int &bar;
script_attach(1000);

//LOOP START

&laser_map = &player_map;

loop:

//INCREASE LASER GUAGE LEVEL
&laslvl += 1;
if(&laslvl > 34)
&laslvl = 34;


//UPDATE GFX

&bar = create_sprite(45, 15, 5, 119, &laslvl);
wait(250);
sp_nodraw(&bar, 1);
sp_active(&bar, 0);
//LOOP IF STILL ARMED GUN

if(&itemID == 2)
goto loop;

//END OF LOOP

kill_this_task();
}


Don't worry about the laser gun item, it was working. Oh, and I have 30 global variables. I also have some Windows XP dlls, (Just to get rpg maker XP running on 2000) if that's any help.

08-11-2005, 07:01 PM
It's well known that load_game kills all scripts. If that's not it, well, I'm stumped. Personally, I never use background scripts; however, there are many dmods which do use them (Lyna's story, etc.)

Please give more context. Is this script spawned when the laser gun is armed? What happens when you rearm the gun? What other scripts modify &itemID? And, most importantly, where does this script go wrong?

SimonK
08-11-2005, 11:42 PM
Hmmm, nothing leaps out at me.

Delete the second script_attach() command.

Change the &bar = create_sprite

to something in which you just reset the sp_pframe of the sprite as maybe you have ended up with too many sprites on the screen... although sp_active should've taken care of that