The Dink Network

Yet another script question

September 9th 2007, 03:55 PM
dinkdead.gif
Why does the following script not work? Dink says "It's here" whether the sprite is visible or not, and I can't work out what I'm doing wrong.

void main (void)
{
int &here = sp_nodraw(&current_sprite, -1);
//uncomment following line to test
//sp_nodraw(&current_sprite, 1);
}

void talk (void)
{
if (&here == 0)
{
say("It's here!", 1);
}
}
September 9th 2007, 04:53 PM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
void main (void)
{
//uncomment following line to test
//sp_nodraw(&current_sprite, 1);
int &here = sp_nodraw(&current_sprite, -1);
}

September 9th 2007, 05:16 PM
dinkdead.gif
Oh... yes. I should've realised that from my other question. Thanks!

Can I set the same variable multiple times in the same script, for example:
void main (void)
{
int &here;
}

void talk (void)
{
&here = sp_nodraw(&current_sprite, -1);
if (&here == 0)
{
//whatever happens goes here
}
}

void hit (void)
{
&here = sp_nodraw(&current_sprite, -1);
if (&here == 0)
{
//whatever happens goes here
}
}

void somethingelse (void)
{
&here = sp_nodraw(&current_sprite, -1);
if (&here == 0)
{
//whatever happens goes here
}
}

or would I have to use seperate variable names?
September 9th 2007, 05:18 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Yes, you can.
September 9th 2007, 05:22 PM
dinkdead.gif
Great
September 10th 2007, 03:42 PM
dinkdead.gif
Might as well ask this in here...

To add new graphics, do I just pick an unused sequence number from WDE and edit the .ini file as described in DinkC.chm, or is there more to it than that?
September 11th 2007, 08:27 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
That's it, though there's slightly more that can be told about it.

First of all don't forget to make sure the graphics are in the right palette. (Or you'll force the player to use true color mode)

Secondly make sure that you choose the right unused sequence number. For example, sequence 348 is unused. But if you do choose it, the game can use it as part of the red trader's walking sequences.
A safe rule of the thumb is that if only the last digit is different from a sequence that belongs to an animal or a person you shouldn't use it.
So using 44 probably isn't a good idea (pig sprites), but using 39 is fine.
September 11th 2007, 04:12 PM
dinkdead.gif
Thanks. Maybe while I'm learning I'll make some kind of FAQ thing: things that you can't do or things that I found it hard to find information about.

Incidentally, does it really matter about the palette, because isn't true colour on by default anyway?
September 11th 2007, 04:18 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
No, it isn't. In fact I play every DMOD on normal (8-bit) mode unless the readme explicitly states that truecolor is necessary. I might become to conservative for this world...