Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Visual Editor: anyway to see spriteID directly without (re)creating data.agkd?

Author
Message
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 15th Jan 2018 14:07
Just for ease of workflow I would like to see the spriteID 10000xx value while i work in the VisualEditor, is this possible?

In case I can't....
I also know that all VE created sprites have a 100000 base start, and that naming conventions are Sprite 0, Sprite 1, Sprite 2 etc

So can I always trust calculating the spriteID from the original sprite name? Eg Sprite 19 has spriteID 1000020,

Let me know if I havent been clear!
Adam
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Jan 2018 15:16
Quote: "So can I always trust calculating the spriteID from the original sprite name?"


I would absolutely NOT do that. When a sprite is created, it returns the ID of that sprite. Just store it in an array if need be.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 15th Jan 2018 19:42
Thanks, just to clarify, in what circumstances does the visual editor not give spriteName = "sprite 25" the spriteID = 1000024?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 17th Jan 2018 17:12 Edited at: 17th Jan 2018 17:14
Quote: "in what circumstances does the visual editor not give spriteName = "sprite 25" the spriteID = 1000024"

In the case you create or delete a sprite yourself.
But even if you go fully with VE and don't create sprites manually, I recommend you to not abuse the sprite name to retrieve the SpriteID.
Isn't there a command that returns the ID if you pass the sprite name as parameter ?
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 17th Jan 2018 18:16
Quote: "Isn't there a command that returns the ID if you pass the sprite name as parameter ?"

yes
ID = VisualEditor_GetID("name",scene_number)
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 18th Jan 2018 09:20
Thanks guys!

I am writing an automatic code producer via a web app, so i can assign functions to sprites (eg interactions with boundaries, sprite changes on various interactions etc) the record types and clones get created automatically and the code is cutnpaste from html output. However the spriteID (essential as record field) is NOT visible in the VE and requires me to actually run AppGameKit to see it!
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 18th Jan 2018 10:07 Edited at: 18th Jan 2018 10:10
i would assume this is because you don't create the sprite until you run AppGameKit so there is no actual ID to return yet - you could create your own sprites in between the loading of the editor scene and cause the count to start at a higher number than expected etc.

also if you delete a sprite in the VE it won't fill the gap when you create the next sprite, the new name will be the next one in the list - so if you were up to say 65 sprite and deleted sprite 40, when you place another sprite it will be sprite 65 (40 will now be non-existent).
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 19th Jan 2018 11:05 Edited at: 19th Jan 2018 11:07
Thanks smallg! I'll have a look at that!

Just for completeness if anyone else is going to procedurally generate code and needs an as of yet uncreated spriteID... my work around is to....

...write a debugging production function that loops through all VisEd_sprites and cross references the name with the generated recordType spritesType.spriteName and where matching check both have same spriteID (as per their system of spritename no => 10000x). Then if gets out of sync I manually fix....

Login to post a reply

Server time is: 2024-03-28 15:58:41
Your offset time is: 2024-03-28 15:58:41