The Dink Network

Reply to Generic 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:
 
 
January 6th 2005, 06:06 AM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
What would be the most useful generic scripts to have? I've been working on a few (typical NPC, typical shop, and typical random object) but am slowly hitting a standstill.

I'm trying to make them easy to understand and edit, so that those new to d-mod creation can use them to help make their own d-mods, yet also make them complex enough so that an experienced d-mod author could use them and not feel they were lacking in some areas.
Example (though this hasn't been fully annotated or explained as of yet)...


// A generic script for an NPC.

void main ( void )
{
}

void talk ( void )
{
int &hello = sp_editor_num(&current_sprite);
int &greet = editor_seq(&hello, -1);

freeze(1);
freeze(&current_sprite);

//HAVE WE EVER SPOKEN BEFORE?
if (&greet == 0)
{
&greet = 1;
editor_seq(&hello, &greet);
say_stop("Hey, have we spoken before?", 1);
say_stop("`%Nope. Not in this adventure, anyway.", &current_sprite);
goto done;
}

//THE CONVERSATION STARTS HERE
startloop:

choice_start();
set_y 240
set_title_color 9
title_start();
"Description of the NPC"
title_end();
"Gossip"
"Leave"
choice_end();

if (&result == 1)
{
say_stop("Have you heard any gossip?", 1);
say_stop("`%No, not really.", &current_sprite);
say_stop("Oh... never mind then.", 1);
goto startloop;
}

if (&result == 2)
{
goto done;
}

// FINISH THE CONVERSATION
done:
unfreeze(1);
unfreeze(&current_sprite);
return;
}

void hit( void )
{
say_stop("`%That's not very nice, is it?", ¤t__sprite);
}


I'm thinking that if I can come up with a few of these scripts, and stick in a help file or two to explain what does what, and why it's a good idea etc etc, it will be pretty helpful.

Ideas? Comments? Spare change?