Reply to D-Modding tips 'n tricks
If you don't have an account, just leave the password field blank.
I've collected together a bunch of random useful tips and things while learning D-Modding, scripting, mapping etc. I did think recently of releasing it as a 'helpful file' but think it would be better here, partly because I'm not so sure of it's usefulness (
) and partly so others can add their own tips & tricks to the discussion, or correct mine.
Some I worked out myself, some are in the DinkC Reference, some both... They could all be really obvious to everyone else for all I know, especially anyone who knows anything about programming rules (I only know DinkC)
Anyway, here it is.
DinkC =============================================
- I wanted to use &bloody_duck_is_dead_at_last as a local variable but it was too long.
So I checked and the max size of a variable (local or global) is 18 characters, not including the ampersand (&).
eg: &helloandgoodmorning won't work
but: &helloandgoodmornin will work.
Not including the colon (: ) , the max size of a goto label is 107 characters! So you could use whole sentences if you like.
With both of those it may be better to keep them shorter 'just in case', but I didn't have any problems while testing.
- You can't use variables as goto labels - whatever the label is it will go to.
the script will stop executing because it can't find '&test' to go to.
it will go to &test whether it is a variable or not.
Many symbols are ok to use also, I tested *+-^$%&"<>?! and they work fine so I presume any ASCII symbol will work, but I wouldn't try ";" ":" etc for obvious reasons. They are fine in variables too according to the DinkC Ref.
- sp_clip_top/bottom/left/right works oddly. You need to clip a bit in the editor before they'll work, or set where the clipping starts from first. See this thread.
- You can use variables for colour codes. For example:
will say 'Wheee!' in a random colour.
You don't actually need to put a space between the variable and the rest of the text, but it makes it easier to read when you're looking at the scripts.
will work just the same.
- Colour code 14 (`$) is the default colour that Dink normally uses, if you're interested in changing it or whatever.
- If you use sp_blood_seq you have to put sp_blood_num as well or it won't work, and vice-versa. Just use the default for the one you haven't changed.
- If nohit is set to 1 the hit procedure will still be called. Why would you want this?
If you want no hit sound to be played and for missiles to pass through but you still want something to happen in a script, for example. I dunno.
- If you create a sprite and have it say something straight away the words will appear at its base.
Stick a wait(1) in between to make it work.
WinDinkEdit+ ==============================================
- Tools > Options > Tile Brush is the size of the brush when editing hardness tiles.
-Clipping sprites: Z is from top left, X is from bottom right.
Select the sprite and don't use ctrl+z, just z.
- The sprite library is a very useful and seemingly little-known tool to store often used sprites. Right click on a sprite and select 'store sprite'. Enter whatever name you like and it will now be under 'sprite library' in the sidebar, just double click on the name to get one - it will remember attributes eg. script, size, nohit, brain, etc. Great for grass, trees and stuff.
Can't think of anything else right now...

Some I worked out myself, some are in the DinkC Reference, some both... They could all be really obvious to everyone else for all I know, especially anyone who knows anything about programming rules (I only know DinkC)

Anyway, here it is.
DinkC =============================================
- I wanted to use &bloody_duck_is_dead_at_last as a local variable but it was too long.

So I checked and the max size of a variable (local or global) is 18 characters, not including the ampersand (&).
eg: &helloandgoodmorning won't work
but: &helloandgoodmornin will work.
Not including the colon (: ) , the max size of a goto label is 107 characters! So you could use whole sentences if you like.
With both of those it may be better to keep them shorter 'just in case', but I didn't have any problems while testing.
- You can't use variables as goto labels - whatever the label is it will go to.
int &test = 15; goto &test; 15:
the script will stop executing because it can't find '&test' to go to.
goto &test; &test:
it will go to &test whether it is a variable or not.
Many symbols are ok to use also, I tested *+-^$%&"<>?! and they work fine so I presume any ASCII symbol will work, but I wouldn't try ";" ":" etc for obvious reasons. They are fine in variables too according to the DinkC Ref.
- sp_clip_top/bottom/left/right works oddly. You need to clip a bit in the editor before they'll work, or set where the clipping starts from first. See this thread.
- You can use variables for colour codes. For example:
int &col = random(9, 1); say("`&col Wheee!", &sprite);
will say 'Wheee!' in a random colour.
You don't actually need to put a space between the variable and the rest of the text, but it makes it easier to read when you're looking at the scripts.
say("`&colWheee!", &sprite);
will work just the same.
- Colour code 14 (`$) is the default colour that Dink normally uses, if you're interested in changing it or whatever.
- If you use sp_blood_seq you have to put sp_blood_num as well or it won't work, and vice-versa. Just use the default for the one you haven't changed.
- If nohit is set to 1 the hit procedure will still be called. Why would you want this?
If you want no hit sound to be played and for missiles to pass through but you still want something to happen in a script, for example. I dunno.
- If you create a sprite and have it say something straight away the words will appear at its base.
Stick a wait(1) in between to make it work.
//Hello! will appear at x/y or so and Goodbye! will appear correctly above the sprite unless you stick a wait(1) after the create_sprite. int &sprite = create_sprite(x, y, blah blah); say_stop("Hello!", &sprite); say_stop("Goodbye!", &sprite);
WinDinkEdit+ ==============================================
- Tools > Options > Tile Brush is the size of the brush when editing hardness tiles.
-Clipping sprites: Z is from top left, X is from bottom right.
Select the sprite and don't use ctrl+z, just z.
- The sprite library is a very useful and seemingly little-known tool to store often used sprites. Right click on a sprite and select 'store sprite'. Enter whatever name you like and it will now be under 'sprite library' in the sidebar, just double click on the name to get one - it will remember attributes eg. script, size, nohit, brain, etc. Great for grass, trees and stuff.
Can't think of anything else right now...