The Dink Network

I want to know a few scripts...

February 27th 2006, 01:18 PM
slayer.gif
I want to know scripts such as...

making a sprite explode
having a sprite other than the sprite you are talking to comment
adding music to the screen
having Dink take damage

That was all... for now.
February 27th 2006, 02:50 PM
slayer.gif
Now I want to know how to

get gold
open a chest

...for now.
February 27th 2006, 03:36 PM
pq_knight.gif
REDIIIX
Peasant They/Them
 
Hi Vukodlak !
You should enter develop folder (in the main Dink SmallWood directory of course and read DinkC reference and other files (if you want).Everything about scripts and many other things is in there.

Ps.I'm using the 1.08 version, but if you use a different version, don't worry.Develop folder should be similar (though, I'm not at 100% sure).
Ps.2.A big thank for redink1 and others, who have created and still upgrades the 1.08 version (it rocks !!).
February 27th 2006, 03:38 PM
slayer.gif
I read the DinkC reference. It had nothing new to me that coul've helped.
February 27th 2006, 03:47 PM
slayer.gif
Wait! Now it has.
February 27th 2006, 04:16 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
making a sprite explode
You should check redink1's bombrox.
February 27th 2006, 04:19 PM
slayer.gif
I could, but my modem speed is 46 kbps. So it takes over 80 minutes to download.
February 27th 2006, 04:26 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
I know this kind of problem. My download speed is 3kbps, so I didn't downloaded it either. Anyway, from other people reviews, it seems to be a good tutorial.
February 27th 2006, 05:15 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Another invaluable source of information is the appropriately named source.zip in the same develop folder. It has all DinkC scripts of the original game. All.

So if you want to know how a chest works, go to a screen with a chest in (Win)DinkEdit, check what script it has, and look it up in source.zip. Chests usually start with ch1- ch2 or ch3-, so you might check those.
February 27th 2006, 05:30 PM
pq_knight.gif
and1
Peasant He/Him
 
Music is easy if you have WinDinkedit of aney king when you are on screen right click with mouse and chose properties and then you have insert your midi number and it will play
February 28th 2006, 01:42 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
It is a good tutorial, but it isn't very good for beginners. It's rather advanced stuff. Look at the script s4-rock to see how to blow a sprite up. (That's the script of the blowable rock in Windemere)
February 28th 2006, 09:05 AM
slayer.gif
Hey... by tinkering up the source.zip, could I change the scripts so I could remember them more easily?
February 28th 2006, 11:48 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Yep you can, but I recommend to make a back-up first.
February 28th 2006, 03:03 PM
slayer.gif
There's still one script I couldn't find in the source.zip.

having a sprite other than the sprite you are talking to comment

So, could you know?

And also, I managed to make the script so I could actually open the chest but it doesn't create any gold with it. And also, I made it to pick up a gold coin, it disappeared, but the hardiness remained.
February 28th 2006, 04:16 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
"having a sprite other than the sprite you are talking to comment":

You'd have to know its active sprite number, which is a bit tricky for starters. There are (at least) three methods:

First method:

Go into DinkEdit (maybe WinDinkEdit too), and look up the number of a sprite. In DE it's done by pressing i. Write the number down somewhere, I'll refer to it as ###number###.

In your code:

int &guy = sp(###number###);
say_stop("Hehehehe", &guy);

The weak point of this method is that everytime you change that particular screen, or switch editors (after working with DE, then working with WDE), the ###number### might change.

Second method:

Add a script, guy1.c for example, to the talking sprite. In it, write this (or add the lines if there's already a script on it):

void main( void )
{
&guy = &current_sprite;
}

Then open up main.c and add this line under all other globals:

make_global_int("&guy", 0);

This'll make &guy globally accessible, the downside is that you need to reserve a global for this use. You can recycle global variables, but for every sprite on one screen you want to be able to talk this way, you need a separate global.

The third method:

In the script where you want the person to talk, use create_sprite():

int &guy = create_sprite(###x###, ###y###, ###brain###, ###seq###, ###frame###);

###x### and ###y### are the coordinates you want it to appear.
###brain###, the brain, 16 for 'intelligent' humans, you'll have to set sp_speed() and sp_base_walk()
Alternatively, you can use brain 0, but it'll just be standing still and act like a statue all the time.

Now you can use
say_stop("Hehehehe", &guy);

The downside of this method is that it only works in one script, so if you want the guy to talk also in other scripts, you can't use this method.

-----

The chest, look at the scripts starting with ch1- in source.zip. Somewhere it'll do some &save_x and &save_y stuff, and do external("make","something");

The &save_x and &save_y are the coordinates where the gold will be dropped, "make" refers to make.c (open it, and see!) "something" refers to void something( void ) inside make.c.
Look at the scripts starting with ch1- to get a feel for how it works.

-----

To make the hardness go away, look at some of the gold-creating procedures of make.c (or emake.c, or any other). It'll call an sp_script() somewhere, this adds a script to the sprite that's created. Look for the script (for example sp_script(&crap, "heart"); will make a big heart, but now you'll have to look for some gold), and see what happens in void touch(void). I guess something like this:

sp_hard(&current_sprite,1);
draw_hard_sprite(&current_sprite);

This is the code that removes hardness.

-----

I hope this helps. Again, look in source.c, check the main Dink map and see what scripts are attached to what sprites. Also, if you have other D-Mods, see if there's source code available. Quest for Cheese sourcecode (and D-Mod itself!) is pretty good if I remember correctly.
March 2nd 2006, 11:48 AM
slayer.gif
Now I want to know how to make a sprite play a sound when it's hit. Such as making a pig oink, the sound file's name is "pighurt" if that can be of any help. What do I have to write after the command "playsound"?
March 2nd 2006, 01:32 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
From the DinkC reference:
playsound(int sound_number, int min_speed, int rand_speed_to_add, int active_sprite, bool repeat);

Now the first thing you need to check is the number of the sound. To do so check START.c. All the sounds are loaded there.
Now I don't see "pighurt" so that probably means it's a file you added yourself. In that case you have to load it in START.c first. You need to give each sound a unique number there. Just add load_sound("pighurt.WAV",50); or something like that. The second thing you need to know is the playspeed. (according to the DinkC reference typical values are 16000 and 22050 Hz).
This means that your typical playsound(); command will look like:

playsound(50,22050,0,0,0);
March 6th 2006, 06:37 AM
slayer.gif
Hmm... uh, thanks. I'll try understanding it someday.