Display score integer as text?


Author
Message
Chemical_Music
Chemical_Music
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K 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 (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 4, Visits: 83
Thank you so much!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search