The Dink Network

Problem detecting (lack of) enemies.

July 14th 2005, 02:37 PM
fairy.gif
Arik
Peasant He/Him
 
Ran into something odd when trying to put together some fixes for Scarab - it appears to be the cause of the problems with books on level 3 of the TOA and with getting a bottle of water in the oasis area. Using this :-

if (get_sprite_with_this_brain(9, &current_sprite) != 0)
{
return;
}
Caused the script to end when no brain 9 sprites were on screen. Trying to work around it, I found that this :-

int &stuff = get_sprite_with_this_brain(9, &current_sprite);
if (&stuff != 0)
return;

Works fine. Just so long as I've got it working I'm happy, but can anyone give me any ideas as to what's wrong with the first one?
July 14th 2005, 02:45 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
You see, DinkC it's not like C, or Pascal, or other languages, where you can put several commands on the same line.
For example, I think
&variable +=1; &variable *=5;
will not work, unless you put them on different lines.
I guess you have a similar problem.
July 14th 2005, 02:51 PM
bonca.gif
Christiaan
Bard They/Them Netherlands
Lazy bum 
Excusez-moi, lad, but I don't think you read his question correctly as well as his script.
July 14th 2005, 04:12 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
DinkC is very picky on what functions can be placed in conditional statements. I'm not exactly sure what the criteria is, though.
July 14th 2005, 05:05 PM
anon.gif
Arik
Ghost They/Them
 
Yeah, that's the conclusion I came to. I just thought this was weird because so many DinkC scripts rely on using this function in conditional statements when determining whether to release a screenlock. It'll teach me to make assumptions, I guess.
July 17th 2005, 04:46 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Cypry WAS right... There's 2 times () in that line, and I don't think Dink can handle it.
July 17th 2005, 05:10 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
But the funny thing is, it does exactly that in several scripts from the original game. So it can handle it... sometimes.