ID:1540634
 
(See the best response by Pirion.)
Code:
mob/Creation/verb/SubmitCreation(f as file)
set category = "Creation"
var/filename = "[f]"
var/file_extension = copytext(filename,length(filename)-3)
var/filesize= length(f)

if(file_extension != ".dmi")
alert(src,"THIS ISN'T A DMI FILE")
return
else
var/b=alert(src,"File Size: [filesize]",,"Proceed","Cancel")
if(b=="Proceed")

if(src.Making==1)
world<<"NOW"
src.Making=0

//Now I want the icon that's associated to the file that he selected to be created on the player's location on the map something like new f (src.loc)

return
else
return


Problem description:Hello, I wrote this code so the player will be able to draw his own icons and when he presses the SubmitCreation verb his icon will be created on his location on the map

Thanks,
,MistY,
I'm thinking what you want is to create a new object and set said object's icon to f. I've never done that so this is just a guess, but I don't see why it shouldn't work.

Edit: Not f directly, but the path to the file.
In response to FKI
Not f directly, but the path to the file.

Can u give me an example?
This is what I meant.

var/icon/i = new/icon(icon_file)

...

object.icon = i
Best response
Simple as creating an object and assigning the file as the icon.

mob/verb/ChangeTurfIcon(RemoteFile as file)
var/obj/o = new(src.loc)
o.icon = RemoteFile


Or changing the turf file

mob/verb/CreateObjectWithIcon(RemoteFile as file)
var/turf/o = src.loc
o.icon = RemoteFile
You should really probably be using 'as icon' instead of 'as file' here, just so they're given the proper file selection dialog.
It works now :) thank u so much.

,MistY,
In response to Nadrew
Nadrew wrote:
You should really probably be using 'as icon' instead of 'as file' here, just so they're given the proper file selection dialog.

Sorry yes, I should have used icon.