The Dink Network

New item problem.

November 4th 2014, 04:29 PM
goblinh.gif
mkbul
Peasant He/Him Greece
TPA~ 
Hello folks. I am working on some new items for an old project of mine. However i've run to a problem. Check this out:

void buysw2( void)
{
int &junk = free_items();

if (&junk < 1)
 {
         choice_start()
        set_y 240
        title_start();
You are carrying too much.
        title_end();
         "Ok"
         choice_end()
 return;
 }

if (&gold < 2000)
 {
         choice_start()
        set_y 240
        set_title_color 6
        title_start();
Not enough to buy!
        title_end();
         "Ok"
         choice_end()
 return;
 }
&gold -= 2000;
add_item("item-sw2",521, 25);
}


load_sequence graphics\newitems\item-w 521 NOTANIM


My problem is, the vendor simply takes the gold, but no sword is given. The sword code is a copy of the clawsword code with very little changes that do not mess up the script in any way.

What am i doing wrong, C gurus?
November 4th 2014, 04:40 PM
wizardg.gif
Is free_items(); an actual command?

Not sure why the sword isn't being added though.

Edit:
I mean if you're losing the 2000 gold it doesn't really make sense that the add_item() line right below it doesn't do anything. The sword should be there in your inventory. Even if the script "item-sw2" doesn't exist, the seq, frame you called should still load a graphic into the inventory.
November 4th 2014, 04:44 PM
goblinh.gif
mkbul
Peasant He/Him Greece
TPA~ 
free_items(); is an actual command yes. It is also used by Seth on some scripts if you check the source code.
November 4th 2014, 04:53 PM
wizardg.gif
You should check the value of free_items(); before and after adding the sword and see if it changes. That should help narrow down where the problem lies.
November 4th 2014, 06:53 PM
spike.gif
Looks fine to me. Do the item-w graphics show up in the editor? All slots until the 25th frame have to exist, you can't have empty slots in the middle. Also, with the way you've written it in the dink.ini, those graphics should be called "item-w01.bmp", "item-w02.bmp", etc. (instead of item-w-01.bmp, like graphics in the original game are written)
November 4th 2014, 08:23 PM
wizardb.gif
Endy
Peasant He/Him United States
 
^That is the only thing I can think of.

I ran it with it using the standard item graphics and it worked fine. I also tried deliberate errors in the item script and it still loaded correctly.
November 5th 2014, 04:43 AM
goblinh.gif
mkbul
Peasant He/Him Greece
TPA~ 
I found the problem. Turns out the dir.ff i had packed my graphics in was corrupt and it was reading it but not actually loading it. Either way folks thanks for the help! Who would believe the Dink Smallwood community would be active after all these years!
November 5th 2014, 05:05 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Crazy, isn't it?