Page 1 of 1

How to access text of created clone through sprintf

PostPosted: Sun Aug 21, 2016 7:06 pm
by lverona
One can create a created clone like this:

Code: Select all
CreateActor("stats_num", "icon", "(none)", "(none)", view.x+110, view.y+294, true);
getclone(stats_num.clonename)->textNumber=minutes;


So here I have no problems writing to textNumber.

However, I don't know how to write to text. I tried this, but it doesn't work. Any ideas?

Code: Select all
sprintf(getclone(stats_num.clonename)->text,"%d:%02d",minutes,sec);

Re: How to access text of created clone through sprintf

PostPosted: Thu Aug 25, 2016 10:53 pm
by skydereign
That works for me. Do you have multiple stats_num actors?

Re: How to access text of created clone through sprintf

PostPosted: Fri Aug 26, 2016 9:12 pm
by lverona
Yes, I do. Multiple. Basically, the idea is to quickly generate text, without having to create several different actors beforehand with set text. So I want to create it on the fly. No problem with numbers, but with text it is a nightmare.

Re: How to access text of created clone through sprintf

PostPosted: Mon Aug 29, 2016 6:43 am
by skydereign
If you have multiple then stats_num.clonename will only get you the clone with the highest cloneindex. Can you check if the setting text is working on that clone? If you want to target specific ones you'll need to use a getclone2 function.