Say:
var/icon/I = input("Get the icon") as icon|null
You can get the name of the file by just using << "[I]" and using length gives you the length of file. name also isn't a varible.
Thanks for the help in advance.
ID:169875
![]() Apr 18 2005, 7:03 pm
|
|
Something that has stumped me for a while, how do you get the length of a filename if you pull it in as an icon.
Say: var/icon/I = input("Get the icon") as icon|null You can get the name of the file by just using << "[I]" and using length gives you the length of file. name also isn't a varible. Thanks for the help in advance. |
Thanks, I'll try it when I get home and post an update.
Heh, nope.
runtime error: Cannot read 'H2.dmi'.icon
(makes sense) from mob/verb/Test() |
Yota wrote:
OK, I havn't tested this or anything, but try... length("[I.icon]") /icon happens to have an 'icon' variable. But he was asking about an icon file, not an /icon datum. As it is, /icon.icon will not give you a file length because it's an internal structure. However, if the icon was selected as a file, length(iconfile) should work. If not, then try length(file("[iconfile]")), which should convert everything to the proper format. Lummox JR |
I tried those ways and ended up getting the size of the data. I think I didn't say what I needed clearly enough, sorry.
If someone selects a file called "Guy.dmi" I want it to show the length of the file name, being 7. |
mob/verb Here is your code. this will let you pick the file on your computer and then tell you the size of it in bytes. |
SSJ2GohanDBGT wrote:
I tried those ways and ended up getting the size of the data. I think I didn't say what I needed clearly enough, sorry. Oh yeah, that's easy. length("[iconfile]") Note this will only work for an actual file, not an /icon. Lummox JR |
/icon happens to have an 'icon' variable.