ID:168767
 
For my game, I need a way to make icon files be transferred into the directory of the game as they are uploaded so the map can reload the saved icons.

I do have security on it, so players who don't trust me with their icons (though almost anyone who knows me remotely would know I wouldn't steal their silly icons I'd rather make my own) won't upload.

here's an example of what I've tried:

        if(src.iconsecurity == 0) //this is set with a yes/no alert upon every login, new char or saved.
var/icon/X = file("/savedicons/[src.key]/[src.customtile.icon]")
X = src.customtile.icon
src.customtile.icon = X
else
src << "Your tiles you make will not be saved in the update."
src.customtile.dontsave = 1


It doesn't make a new icon though. :(
I want it to pop up as C:/Program Files/Byond/bin/(game)/savedicons/(player's key)/(filename).dmi. I have my savefiles save like this, but it aparently doesn't work with icons :P

If there isn't a way to do what I want it to I'd understand that (so that games with evil people that don't set security like me can't steal icons) but if there IS a way, I'm sure the fanbase would appreciate it because every time I reboot they lose their custom turfs :(

Wait.

Scratch that: I'd appreciate it if there is a way, because I can reboot more often without getting barked at :D
Rather than "/directory" try "./directory". The "." makes it start at the current directory. Lacking that, "/directory" makes it start at the root of the drive (C:\).

I'm not sure how well that method would work anyways. You might want to look into using savefiles instead.
In response to Jon88
well Windows isn't finding an "A.dmi" (the file name I used to test that)--let alone in the right directory--So its not making the file.

Btw I'm using Gazoot's dmpmaker so that's why I wanted files and not savefiles (I can just compile the map and can still edit it if I need without erasing the map.)
In response to Cowdude
I know its only been 23 1/2 hours, not 24. Sue me.

I have it working how I need it, except for one problem. Here's one of the three sections of code that don't work right (They're all identical except for variable names.)

                        if(src.iconsecurity)
src << "Any items left on the map will not be saved."
X.dontsave = 1
else
I = fcopy(I,"Icons/[src.key]/Items/[I]")
X.icon = I

The problem is that when it branches off to the "else" section (meaning when people are cool trusty people) the icon disappears :(

Am I misusing fcopy()?
In response to Cowdude
Cowdude wrote:
>                       if(src.iconsecurity)
> src << "Any items left on the map will not be saved."
> X.dontsave = 1
> else
> I = fcopy(I,"Icons/[src.key]/Items/[I]")
> X.icon = I
>

The problem is that when it branches off to the "else" section (meaning when people are cool trusty people) the icon disappears :(

Am I misusing fcopy()?

fcopy() doesn't return anything other than a 1 on success or a 0 on failure. You should be able to keep using I just like before the fcopy()
<_<

BYOND saves any uploaded icons to the resource file on the host's computer. Or so it seems. the resource file seems to get bigger after everytime someone hosts the game, and people always use custom icons that somehow magically appear after reboot. If this is dealing with turfs and they come out black after loading the map, you are placing the turfs incorrectly.