Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

in Questions Posts: 616

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!

Comments

  • dave1707dave1707 Mod
    Posts: 8,398
        img=readImage(asset.builtin.Tyrian_Remastered.Boss_C)
        saveImage(asset.Icon,img)    
    
  • Posts: 616

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

  • SimeonSimeon Admin Mod
    Posts: 5,364

    @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

  • SimeonSimeon Admin Mod
    Posts: 5,364

    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)

  • dave1707dave1707 Mod
    Posts: 8,398

    @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.

  • edited May 14 Posts: 616

    later it did come up. that's odd

  • Posts: 616

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

  • dave1707dave1707 Mod
    Posts: 8,398

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

  • Posts: 616

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

  • dave1707dave1707 Mod
    Posts: 8,398

    @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)
    
  • edited May 14 Posts: 616

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

  • SimeonSimeon Admin Mod
    edited May 15 Posts: 5,364

    @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

  • Posts: 616

    Thanks, I'll look for that :)

Sign In or Register to comment.