Display score integer as text?


Display score integer as text?

Author
Message
Chemical_Music
Chemical_Music
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 4, Visits: 83
Hi,
I am trying to display a running score as the participant completes a task, and I am having trouble using the format function to add the score to a string that can be used as text.

Here is my code, with values.score as the integer that gets updated in the task: 

<item scoretext>
/1 = format ("Score: %i", values.score)
</item>

<text scoretext>
/items = scoretext
/ position = (80%, 5%)
/ size = (50,50)
</text>

When I display scoretext, all it does is show the string "Score: %i" rather than replacing %i with the integer.
Am I supposed to use the format function in a different way?


Dave
Dave
Supreme Being
Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)Supreme Being (708K reputation)

Group: Administrators
Posts: 9.8K, Visits: 47K
The proper way to use a function inline is

<values>
/score = 5
</values>

<text mytext>
/ items = ("<%format(~"Score: %i~", values.score)%>")
</text>

If values.score is an integer anyway, you do not need the format function at all, btw. You simply do:

<text mytext>
/ items = ("Score: <%values.score%>")
</text>
Chemical_Music
Chemical_Music
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 4, Visits: 83
Thank you so much!
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search