The Dink Network

Re: Paul Pliska's Script Trick...

December 26th 2007, 10:40 AM
dinkdead.gif
...I see mentioned quite often here and there, but what is it?!
Is it storing variables in editor_seq()?

Edit: While I'm at it, is this: if (&var) the same as doing this: if (&var > 0) ?
December 26th 2007, 08:33 PM
fairy.gif
Someone
Peasant He/Him Australia
 
1. yes (or editor_frame)
2. I expect that would work in most languages, but I doubt it would in DinkC
December 27th 2007, 04:17 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
1. It works like this:

In the void main() procedure do:
int &var1 = sp_editor_num(&current_sprite);
This will return the editor number of &current_sprite. This number is not the same as &current_sprite. (I believe that usually &var1 = &current_sprite - 1)

int &var2 = editor_seq(&var1, -1);
&var2 will now be equal to the value of the editor_seq(); of &current_sprite.

Then, wherever you wish to store something in the editor_seq:

&var2 = <newvalue>;

And then to store it:
editor_seq(&var1, &var2);

You can use both editor_seq and editor_frame for this. editor_frame will be a number between 0 and 255, editor_seq has a larger range. I believe it has to be positive though...

2. Well, a little test confirms that if (&var) does the same as if (&var != 0). (negative values will return true as well.)
December 27th 2007, 06:19 AM
wizardb.gif
Endy
Peasant He/Him United States
 
It's gotta be positive unfortunatly... Negative values did so not work. I also tried messing with editor type, and the thing dissapeared on me
December 27th 2007, 08:37 AM
dinkdead.gif
Ok thanks all! That'll save a lot of globals.
December 27th 2007, 05:31 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
I expect that would work in most languages

hmm... i wonder if that would work in BASIC?
December 27th 2007, 06:13 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
if {"BASIC"} ⊆ {Most_Languages}, yes.
December 28th 2007, 12:44 AM
wizardb.gif
Phoenix
Peasant He/Him Norway
Back from the ashes 
Wouldn't

BASIC ∊ Most_Languages

make more sense, though? </nitpicking>
December 28th 2007, 08:41 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
I have no idea why I didn't say that instead. X)
December 29th 2007, 06:03 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
???
anyway i saw some examples using the BASIC library i use (PB) and it had statement like

if var.b
blah blah blah
endif

(the .b indicates a byte value)
December 30th 2007, 06:13 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Of course BASIC supports interpreting whether any value means "true" or not. Almost any language does, with the exception of some more quick and dirty scripting languages like DinkC.
December 31st 2007, 11:14 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
i wonder if dink likes it 'quick and dirty'