Changing Gold to Switches
Posted: 2011.05.04 (15:13)
by andreas_xx
I have made a N-art all in gold, and now i'm wondering if it might look better in trapdoor switches. Any way to do that fast in the code for example?
Re: Changing Gold to Switches
Posted: 2011.05.05 (15:48)
by im_bad_at_n
Absolutely, I've done it a few times before (though I use mines instead, as they are easier to see).
Gold has a code like: 0^100,100! where 0^ denotes that it is a gold piece and 100,100 denotes it's location. Successive amounts of gold ends up with 0^468,288!0^408,264!0^468,300!0^432,288!0^456,252 Trap doors' code looks like: 9^468,288,1,1,15,4,0,0,-1!9^468,300,1,1,15,4,0,0,-1! where the 9^ tells the program that the object is a door, the 468,288 is the location of the switch, and the rest of the data describes the door positioning and what type of door it is. It's unimportant what they really mean, but you'll need to watch out for it eventually.
The first step is to copy and paste your gold data into an editing program that has a find/replace function, such as word. Then open up a new clean map, and place a trap door so that the door itself is not within the range of the map (beyond the borders). I prefer to place mine in the top right corner. The trigger for the door can be placed anywhere, it doesn't matter; all you need is the rest of the code. This is the data I get for putting it in the top left corner: 9^180,132,1,1,0,0,0,0,-1
Then add a ! and a 9 at the end of the code: 9^180,132,1,1,0,0,0,0,-1!9
and delete the beginning of the code that describes the location and the type of object, but leave the comma: ,1,1,0,0,0,0,-1!9
First save the map before doing this, and don't save again until it works. Go to the find/replace function in your word program. Type !0 in the find box, then type ,1,1,0,0,0,0,-1!9 in the replace box (or whatever your result is from above). Hit replace and nearly the entire document will change, making nearly the exact number of replacements as the number of objects you have in the art.
Hybrid gold/door: You're not done yet though. At the beginning of the code, you'll have an object that looks like this: 0^100,100,1,1,0,0,0,0,-1. This is because you've replaced !0 with the result, but the first object does not have an exclamation point like the rest of the objects do. To fix this, just replace the 0^ with 9^. THEN go to the very end of you code and you'll see something like this: !9^100,100. Make sure to add the ,1,1,0,0,0,0,-1 to this door to actually make it a door. Note if you don't fix these hybrid gold/door objects you might not get the desired result, especially if you don't fix the first one.
Once you finished fixing these two doors, test out your art by loading it into Ned. If you get your desired result, you can save the document or post to Numa, as you're done. If not, then the best thing to do is to undo everything you did so you're back with the gold nart you started it (why you shouldnt save as you do this).
Hope this helps!
Re: Changing Gold to Switches
Posted: 2011.05.05 (17:55)
by atomizer
To replace all the gold with trapdoor switches:
Code: Select all
sed 's/0^\([0-9]*\),\([0-9]*\)/9^\1,\2,,1,,,0,,/g' <in.txt >out.txt
(everybody stand back, etc.)
For locked door switches run the same thing, but swap the last "1" and "0" in the pattern.
Be aware that trapdoor switch is smaller than a piece of gold, so it may ruin the filled areas.
And, of course, gold <--> mine is a straightforward "0^" <--> "12^" in any text editor.
edit:
sed for windows. I prefer cygwin. Your choice may vary, but mind the quoting and escaping rules - the above line is for bash.
Re: Changing Gold to Switches
Posted: 2011.05.05 (19:21)
by andreas_xx
Thank you so much for the tips :)