How do i make text indicating how much ammo i have left? I have tried making a ammocounter text object, i’m not sure if it’s possible to print a variable? While i’m still writing so i don’t have to ask later on another post, is it possible to make it print 32/267? ← Thinking about making a reload feature with magazines. Btw i know the ammunition is backwards on the pictures below, i was just too lazy to change it
No sure if syntax changed in GD5 or html5 platform, but i’ve never this “.String()” method in GD… But usually to print a variable, use ToString(myVar) function.
To make something like 32/267 :
ToString(MyVar) + “/” + “267”
Just a take look on the wiki for more examples and information about variables manipulations.
So, for this example it should be something like:
ToString(“AmmoCount”) + “/” + “267” or in the () is the quotations not necessary?
i.e.
ToString(AmmoCount) + “/” + “267”
This should be ok, syntax is ToString(Variable), without quotes.
Ok great Hope that helps OP! Thanks Kink
Warning, the syntax is not
ToString(myVariable)
This syntax is to convert a numeric expression (i.e. myVariable is a number, not a variable name, for example Player.X() or Variable(myVar)) into a string.
To get variables as strings you have to use one of these:
ToString(Variable(myVariable)) // If myVariable is a number
VariableString(myVariable) // If myVariable is a string

:!: Warning, the syntax is not
ToString(myVariable)
This syntax is to convert a numeric expression (i.e. myVariable is a number, not a variable name, for example Player.X() or Variable(myVar)) into a string.
To get variables as strings you have to use one of these:
ToString(Variable(myVariable)) // If myVariable is a number VariableString(myVariable) // If myVariable is a string
I was curious about that last night! I was reading some of the syntax on the wiki that pointed in this direction where it talks about platform adding points near the end of that tut. That is why I was wondering about quotations . Thank you!
This is what I am currently reading on this now, and is a great point of reference for the OP and anyone:
wiki.compilgames.net/doku.ph … evariables
You guys are awesome!