The Dink Network

Sprite numbers

WinDinkedit

December 20th 2004, 03:30 PM
goblins.gif
igloo15
Peasant He/Him
 
Is there a way to use windinkedit to find a sprites number. Basically what I want to do is have a city full of people that I add as sprites in windinkedit, but control what they all say from one script. I rather not do a ton of int&per = create_sprite(blah)
for every person on the screen. I would rather create them in windinkedit and then control them by there sprite numbers in one script. Unfortunately i don't know how to get there numbers.
December 20th 2004, 05:47 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Nope. The 'easiest' way I've found is to attach a script to a sprite you want to find the number to and have it say its editor number.
December 20th 2004, 05:49 PM
goblins.gif
igloo15
Peasant He/Him
 
how would i do that
December 20th 2004, 05:56 PM
goblinm.gif
You could just use dinkedit (and press the i key)
December 20th 2004, 06:01 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
'I' for info will give you the #, but that's a bad way to do it since you cannot add more sprites thereafter.
Each could have a script equating a global variable EG;
void main ()
{
&globA = &current_sprite;
}
Next sprite gets &globB, then &globC ect...
Then one script could control them all by those globals.
But you only get about 200 global variables. Even though you could reuse those variables beware the limit.....
December 20th 2004, 06:05 PM
goblins.gif
igloo15
Peasant He/Him
 
I thought of that way but it just wouldn't work because of the number of globals. I was hoping of a different way like that but didn't use as many globals. Someone must know a way. I tried using the i button in dinkedit but it doesn't always work for instance there is a duck in my d-mod that registers as 25 in dinkedit but when i try to use the any of the say commands with that number it just doesn't work. Instead a different sprite says it. Maybe i am writing the say command wrong. say("blah", 25); will make a tree say blah and not the duck.
December 20th 2004, 06:07 PM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
there is a duck in my d-mod that registers as 25 in dinkedit but when i try to use the any of the say commands with that number it just doesn't work. Instead a different sprite says it. Maybe i am writing the say command wrong. say("blah", 25); will make a tree say blah and not the duck. - Igloo

We had a similar problem in Cloud Castle 2. I think we narrowed it down to either being a gap in space time, or an act of God.

Or, in other words, I don't how how Arik fixed it. Sorry.
December 20th 2004, 06:17 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
The problem is you're confusing sprite numbers with sprite editor numbers.

Sprite numbers, like '1' for Dink, are what most commands use. There can be more than 99 of these.

Sprite editor numbers, like what you're attempting to use, are different. There is a sprite number '1', but it is not Dink. You are limited to 99 of these.

There are two main conversions you can do. To change a sprite number into a sprite editor number, do this:

&sprite_editor_num = sp_editor_num(&sprite);

To change a sprite editor number into a sprite number, do this:

&sprite = sp(&sprite_editor_num);
December 20th 2004, 06:23 PM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
You see, this is why I can't answer scripting questions. I haven't got a clue what people are talking about unless they explain it well... and if they can't do it themselves, they can't explain it to a high enough standard for me to understand what the bejeezus they are on about. Or maybe I'm just stupid?

Ah well. My head hurts.
December 20th 2004, 06:29 PM
goblins.gif
igloo15
Peasant He/Him
 
so redink without creating a bunch of global variables what is the best way to control sprites by their numbers in one script.

edit: I have been thinking about using editor_seq() to keep the values but i am not sure how to call them or even get a variable into them.
December 20th 2004, 07:10 PM
goblins.gif
igloo15
Peasant He/Him
 
wait thanks redink i finally figured out what the conversion things meant and it worked without using any global variables. The problem i have now is kinda stupid but, the first time i go on to the screen another sprite besides the duck talks but if i leave and come back everytime after that it works fine. I am just gonna say its some kind of bug in the engine and hope it doesn't mess up anything.

Update: Actually its not working at all. It seems to work if I use global variable to assign the values but not if i don't. For example this script does not work.

int &voice1 = sp(25);
int &voice2 = sp(30);

say("hello mertle", &voice1);
say("hello betty", &voice2);

this will do nothing. If i make &voice1 and &voice2 global variables and do this in scripts attached to the sprites.
&voice1 = sp(25); attached to mertle sprite
&voice2 = sp(30); attached to betty sprite

then in a seperate script do the following.
say("hello mertle", &voice1);
say("hello betty", &voice2);

it works. I am not sure why the first way does not work but the second way does. Anyone know why?
December 21st 2004, 06:52 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Hmm... that's odd. You're not using &voice anywhere, are you? That will cause problems. As a generaly rule, variables cannot start with another variable name.

Try using completely different variables names and seeing if it works.