Multiple properties to a single "Text" property - Not Calculated Value?

Hey guys,

I’m sure python can do this. I’ve had a look on the internet but no luck so here. turning to the wise ones again :stuck_out_tongue: What’s the method to add multiple entries in a string without it trying to calculate a single value out of it?

I’m trying to assign 3 things: 2 Int properties and a “/” (forward slash) inbetween them. Should look like this:

10 / 32 (or some other numbers according to how properties change)

Now, I’ve tried various little ideas like:

prop1 is a string converted from value 1
prop 2 is a string converted from value 2

code:

own[‘Text’] = prop1, “/”,prop2

It did not work… I’ve tried + and () aswell but it all seems to want to calculate an overall number rather than print the values out next to eachother with a slash inbetween…

Thanks for the help guys, honestly appreciated.

Pete

To concatenate strings, you have to use + signs. But yeah, you need to turn your integers into strings if this is the way you want to do that. The “int(value)” and “str(value)” methods convert to an integer or string, respectively.

So what you’ll want is:

newProp1 = str(prop1)
newProp2 = str(prop2)

own['Text'] = newProp1 + "/" + newProp2

(coding gods, if I have sinned by creating new variables, I apologize)

Also, in the future, if you understand the basic thing that you need to do in Python, just google that basic thing. You’ll probably get an effective stackoverflow.com result for it. :stuck_out_tongue:

That is perfection itself! Thank you very much!

I love this forum, genuinely :slight_smile:

You can even do this with the Property Actuator ;):

Property Actuator
Mode: Assign
Property: Text
Value: propertyA + ‘/’ + propertyB