The Dink Network

Reply to Re: I want to know a few scripts...

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
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.