The Dink Network

Reply to Re: Unusual method for one-time events

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
October 9th 2013, 06:13 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Using a global variable every time is pretty excessive indeed. Having many one-time events can really improve the quality of a DMOD, but having a global for all of them is a bit silly. Personally I use a similar technique to yours, it works a little bit differently:

Place some sprite on the screen (usually I take some very noticable out-of-place sprite so it is easily identified in the editor) and attach a script to it. Do a nodraw inside the script (don't do it in the editor as invisible sprites don't execute scripts) and do whatever you wanted to do inside this script. After the script is finished kill it with the editor_type to make it never come back. You might also want to give your sprite a nohit so a fireball doesn't mysteriously explodes in mid-air.

I personally don't see the advantage of placing a script to the room itself and search for the sprite in question. You can just attach the script to the sprite itself! I use this quite often to make sure that a screenlock only occurs the first time the player gets to the screen, so you don't have to get through screenlocked screens many times. I think redink1 really started this with Initiation. He's even made noticable sprites to place on a screen specifically for this purpose.

If you do want to use brains, you can also use exotic numbers. I can remember one dev-file which used brains 95 and 96 to make sure that they probably wouldn't be around by accident.

Also, a different topic for this is much better than in the preview thread. Better to keep discussions a little bit seperated. Besides, more (meaningful) topics, more joy!