The Dink Network

is there a make_global_int max?

April 2nd, 07:44 PM
duckdie.gif
crypto
Peasant
 
make_global_int .... these are of course very useful, is there a max of how many you can define?

If so is there a way to substitute one for other ones.

this is just an example to illustrate the question

say you had two class mage and warrior

but they used different globe vars...

could you only load the warrior ones or mage ones to free up the slots, after the main.c has run?

April 2nd, 08:37 PM
girl.gif
yeoldetoast
Peasant Female Australia steam
discord.gg/Ukugfbh 
There's a maximum of 200. This is a limit in the structure of the save file and therefore cannot be increased beyond that number.
April 2nd, 09:08 PM
duckdie.gif
crypto
Peasant
 
ok fair enough ... so do you know if you can save the initialization of globes for a later time .... after main.c during the game play ?

To answer my self yes you can..... which means ... so long you track them.

you could use 200 for each story line ... so long as you don't break that value, but could have any number in the story .c files ... so long as you don't go over per [ story | quest ].

that maybe hard to follow... almost sure that is the case after messing around with it..
April 3rd, 11:50 AM
duckdie.gif
crypto
Peasant
 
maybe this will not be seen here but it's related,

is there a way to release the global ints ..... like a destroy_global_int ??
April 3rd, 03:00 PM
dinkdead.gif
Not that I know of, however if with judicious use of variables you should not have any problems.

You can reuse some, for example I often have one called &g_temp or something which is used differently in different parts of the game.

In your case, if mage and warrior are not being used at the same time then you can just use the same variables for both in most cases. Just name them differently for clarity, eg, you don't need &strength for the warrior and &magic for the mage, just use &power for both. (not those variable names exactly of course, just an example!)

This file has some great tricks. See the "variable conservation" section.
April 3rd, 03:21 PM
dinkdead.gif
Skurn
Peasant Male Equatorial Guinea xbox steam duck bloop
can't flim flam the glim glam 
isnt there a way to add more
April 4th, 10:02 AM
spike.gif
SlipDink
Peasant Male United States bloop
2nd generation. No easy way to be free. 
There are several ways to make more global variables available (or at least to sort of fake that). I'm pretty certain that these approaches work in all 1.08 or later versions of Dink.

My favorite technique is to use editor_seq() and/or editor_frame() which let you save values associated with a particular editor placed sprite (on any specific screen) in save files. The v3.1 version of the DINKC Reference has this section explaining it:


#editor_seq()
#editor_frame()
# Category: Editor Data
# Prototype:
# int editor_seq( int DinkEdit#, int value <-1 to not change> );
# int editor_frame( int DinkEdit#, int value <-1 to not change> );

[The <DinkEdit#> argument is the sprite's number as assigned by DinkEdit:
use sp_editor_num() to retrieve it. The <value> argument is included in
save files. When editor_type() (below) is 0, the <value> stored by
editor_seq()/editor_frame() has no particular meaning to the dink engine
and, within limits, may be used to store values unrelated to the commands'
intended purpose. The value is 0 by default and may be retrieved by
passing -1 as the <value> argument.]

See editor_type() (below) and "Part 3: A Changing World" for a complete
description of this facility; see also sp_editor_num().

Another technique is to use sp_custom() to attach some new value to any active sprite on any screen. The good news about this one is that "Each sprite can store unlimited keys." as the documentation spells out in "The DinkC Reference v4.0" windows help file (which I believe is bundled with the dink windows download found here). This windows help file describes the use of the sp_custom() function. As it is the 4.0 version of the earlier text based DinkC reference, it also mentions the editor_seq() and/or editor_frame() methods.

Good Luck!