The Dink Network

Save function, is it possible?

December 15th 2009, 02:24 PM
knightgl.gif
Castman
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 

Hey guys ^^

I want to know if is possible to save something but not with use of variables,

Example: I want to save an item that I've got, suppose that it's a massive-bow:

I've got the bow, now I want to leave it somewhere, so I use the "save function" and the game will save the item without use of numeric variables, sort of "&item 1 = Massive-Bow" "&item 2 = Flame-Bow"

Could you understand it? Quite confusing and with this confused English things go worse
December 15th 2009, 04:14 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
I wouldn't think it possible to save it without a global/internal variable, or however the game saves the items.
December 15th 2009, 11:02 PM
knights.gif
pathfinder
Peasant He/Him China
I love hanging ON LINE without doing anything... 
You mean you want to keep your bow in a bank or on the ground?If so,maybe you can set some global varibles to keep the coordinates of your item...and then you can pick them up again...
December 16th 2009, 06:26 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
You would of course have to use some sort of global variable, I think pathfinder's idea sounds the best. There are no text variables in Dink.

You would need at least 3 variables, (X, Y and screen), and you would then need to attach a script to every screen, which runs and spawns your dropped item at the saved location and give it the appropriate attributes etc. I doubt visions would cut it.

Otherwise, no I do not understand what you mean.
December 16th 2009, 07:10 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
Isnt there a game that u can save your items in a chest... is that what u mean?
December 16th 2009, 07:12 AM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
Could editor variables be used instead of globals? Not sure if you can make it work without attaching a script to every screen...

Visions could work, depending on what you need it for, if it is just one item then you could, but you would be doing it on a lot of screens, editor variables could be used to display it at XY coords, though it would probably be easier to just use scripts.
December 17th 2009, 02:00 PM
knightgl.gif
Castman
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 
Thank you everybody

What I want to do is was MsDinkalot said, a chest to store items, but my new mod is already using lots of variables, if I need to create another one to identify each item on the chest I'll overbound the variables limt soon

Using variables I already know how to do, just something like this:

void talk ( void )
{
store:
&ssword = count_item("item-sw1");
&csword = count_item("item-sw2");
&lsword = count_item("item-sw3");

choice_start();
...
"Which item would you like to lay on the trunk?"
(&ssword > 0) "Simple Sword"
(&csword > 0) "Claws Sword"
(&lsword > 0) "Light Sword"
...

if (&result == 1)
{
kill_this_item("item-sw1");
&sword1stored = 1;
goto store;
}
if (&result == 2)
{
kill_this_item("item-sw2");
&sword2stored = 1;
goto store;
}
... ...

As you can see I would have to create on MAIN.C a new variable to each item, and the number would be the quant of this item on the chest.

I want something like this:

void talk ( void )
{
store:
&ssword = count_item("item-sw1");
&csword = count_item("item-sw2");
&lsword = count_item("item-sw3");

choice_start();
...
"Which item would you like to lay on the trunk?"
(&ssword > 0) "Simple Sword"
(&csword > 0) "Claws Sword"
(&lsword > 0) "Light Sword"
...

if (&result == 1)
{
kill_this_item("item-sw1");
: ave to chest "item-sw1" += 1::
goto store;
}
if (&result == 2)
{
kill_this_item("item-sw2");
: ave to chest "item-sw2" += 1::
goto store;
}
... ...

So the chest would have the item name instead of variables and numbers... I still haven't found any way to do this, but I've seen so many awesome scripts from people here that I tough someone already did something like it...

Which game got that "items trunk"? If he didn't used variables would be a solution

Thank you and Good Game,
Castman
December 17th 2009, 04:59 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
With what you're doing, you could just use local variables, no need to waste globals if only a chest script needs them, though you would still need at least one global.

You could do something similar to what they do to store strings in integers, you could encode the information in a global variable and have a script that decodes it to tell you how many of each item is in the chest.

Something as simple as a number where each digit represents an item, having a maximum value of 9.

e.g:

3925310 could mean "three elixers, nine apples, two letters, five alk nuts, three claw swords, one light sword, no bows"
December 17th 2009, 09:18 PM
fairy.gif
Someone
Peasant He/Him Australia
 
I've made the bold claim before that most DMODs require less than 10 active variables (active = globals + active locals).

You need to do something like fireball said to use memory more efficiently. The var limit does not need to be a concern.
December 18th 2009, 09:24 AM
knightgl.gif
Castman
Peasant He/Him Brazil
Some day I'll finish my mod... Some day... 



That was what I was plannling to create but I still don't know how to translate these number codes back into items, 'cos the game won't read the first number separated of the second one...

But I'm working on it, I've downloaded that "Dink Trunk" file, hardcoded but uses the same scheme of number codes to the items.

Thanks a lot ^^
Castman
December 18th 2009, 05:52 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
You could use greater than/less than statements to find the number of the last one

if (&items => 30000)
{
  if (&items < 40000)
  {
    //code here
  }
}


You need both the less than and greater than.

I don't know how you can get the other numbers as well, maybe some kind of equation?