asset style access for "Project:Icon", please?

i give up. what’s the asset syntax for the icon?

and b, why not enhance the deprecated diagnostic to provide the specific translation?

thanks!

    img=readImage(asset.builtin.Tyrian_Remastered.Boss_C)
    saveImage(asset.Icon,img)    

weird, i’d swear Icon didn’t come up when i typed asset.
thanks!

@RonJeffries I had to balance specific translations vs generic warnings because I didn’t want a lot of old projects spamming every single deprecated asset warning on every frame when you ran them. A specific translation for a deprecation warning could mean lots of different sprites would have different suggested fixes. Which is really nice but then I kind of needed a one-time-warning system and didn’t get around to implementing that

This is why I implemented the grouping for identical print messages too, so asset warnings wouldn’t be too spammy

A guideline for now:

Any string that starts:

“Project:File” → asset.File

“Documents:File” → asset.documents.File

“Dropbox:File” → asset.documents.Dropbox.File

“Planet Cute:File” → asset.builtin.Planet_Cute.File
(Where “Planet Cute” is any included asset pack)

@RonJeffries Icon didn’t come up when I typed asset either. I guess autocomplete doesn’t cover every possible situation. I just kept playing around until I found the correct syntax that worked for Icon.

later it did come up. that’s odd

is there no syntax for an arbitrary file in Files, or in Dropbox per se? and what even is the Dropbox folder inside Codea?

@RonJeffries If you have Icon in your code, it will show in the autocomplete just like anything else you add to code.

Here it is on my iPad, not offering Icon as an option, nor accepting it.

@RonJeffries If the Icon image doesn’t exist in the Project folder, then you have to use the … and “ “ just like any file that doesn’t exist.

    saveImage(asset.."Icon",img)

If the Icon image does exist in the Project folder, then you can use just the single . without the “ “ .

    saveImage(asset.Icon,img)

arrgh that’s so easy to use :slight_smile: I’ll try it, thanks!
Works. How can I help get this stuff written down where we can find it?

@RonJeffries it should be in the docs under Graphics → Using Assets

There’s a section on “Creating New Assets” which explains the purpose of the concatenation operator (..) to create an asset key for a non-existent path. It gives an example using saveText to write a text file into your documents folder

Basically any asset that can be referenced via autocomplete or using the bracket ([]) syntax exists on your file system. If Codea is picking it up, it must be there

The .. syntax is required is when you need to specify a path to a file that isn’t there yet

Thanks, I’ll look for that :slight_smile: