The Dink Network

Reply to Scripting help

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:
 
 
December 23rd 2014, 06:41 PM
maiden.gif
So, I'm making my first D-Mod for the Silent Protagonist contest, and a couple of my scripts are not acting as I think they should. I was wondering if people could help with why they might not be working.

My first script contains the following (doctored for after story hits 10)
void main( void )
{
	if (&story < 10)
	{
		&wid = create_sprite(364, 218, 16, 411, 1);
    		sp_speed(&wid, 1);
		sp_base_walk(&wid, 410);
    		sp_script(&wid, "T1-B2.c");
	}
}

However, during my play-throughs, &wid never appears. The script "T1-B2.c" worked fine when he was just placed on the map, so I know the problem is somewhere here.

My other major problem involves a trader. Part of the script is supposed to checks if you don't have a particular item, that you have enough gold for it, and that your inventory is not full. While the third one is impossible without cheating, I've still built in for it for use in future D-Mods. However, when trying to buy an item, it triggers on this even with an empty inventory. Here's the code for an edited throwing axe item (I set the cost to one for testing purposes.)
		&invitem = count_item("item-AXE");
		if (&invitem > 0)
		{
			say_stop("`2You already have one of those.", &trader);
			unfreeze(1);
			return;
		}
		if (&gold < 1)
		{
			say_stop("`2You don't have enough gold for that.", &trader);
			wait(200);
			say_stop("`2Come back when you have!", &trader);
			unfreeze(1);
			return;
		}
		&invplace = free_items();
		if (&invplace < 1)
		{
			say_stop("`2You don't appear to be able to carry any more.",&trader);
			wait(200);
			say_stop("`2I guess you won't need this anyway.",&trader);
			unfreeze(1);
			return;
		}

If anyone can see any errors in these, the help would be most appreciated. There are other errors in my code, but they are minor ones, with only aesthetic consequences, so these are the ones I need to fix before release.