Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Another Script question about tags

A topic by JJXB created Apr 23, 2019 Views: 77 Replies: 3
Viewing posts 1 to 4

is it at all possible to get the tag that is being read on a shape as a string on it's own via variable? Asking because i want to have the ability to have a tag be readable and to be able to read a number from the tag.


instead of doing

if shape:ContainsTag("Z30") then shape.Offset.z+=30 end

and making new tags in that vein for each microscopic change i might want to make, instead i want to tag something ZU60 and something else ZU30 and it'll add the 30 and 60 to each respective object as tagged. to do this i need to be able to read the tag that's being referenced at that moment, find the numbers in it, and then once i've been able to do that, convert the string number to an int number that i can then pass onto shape.Offset.z+=. but i can't read the tag that's referenced to do a string.match or string.find on it for numbers as far as i know unless it's undocumented.

if it's not possible to expose that tag to being read as a string whenever you invoke a shape:ContainsTag currently, may i humbly request that it be made possible since i assume in order to read the tag, you have to store the input for the ("") anyway and that it'd make it easier to do cleaner script code while also allowing for flexibility in tagging.

(2 edits)

String process is complex and power consuming, the best way to do it is store the value into some unused field.

Suppose that you don't use Deform/Animation feature, you can set the patterns DeformOffset.m00 = 30 and 60 respectively and tag all patterns ZU. (DeformOffset.m00 is located at the first line&  first column of DeformOffset matrix)

In the script that type:

shape.Offset.z = shape.Offset.z + shape.DeformOffset.m00

Hope it helps.

Or more simply if your patterns doesn't rotate or scale, you could store additional value on Pivot.x/y/z field.

Or store it in Offset/Scale/Rot fields, in the script after using the value then re-assign a new value for it.


looking like it'll be the deform method then since i often use Offset/Scale/Rot enough that it'll be better to use  the deform vars for storage.