can i get the text result variable ?remove the "
text str(1+2)
should be enough
What do you mean?can i get the text result variable ?
Since quoted content is always a string, in you example you're asking to translate the literal string "1 + 2" into a string... As Winterfire said, the right syntax should beCode:screen test: text str("1 + 2")
str( 1 + 2 ).text str( thisVar + thatVar ) if both "thisVar" and "thatVar" are compatible type ( int/float + int/float, or string + string ).text "{} {}".format( thisVar, thatVar ) if "thisVar" and "thatVar" are not compatible types, or if their type vary and can be not compatible.screen whatever(): # note the highly recommended '()'
$ myVar = "{} {}".format( sum( [ nb for ( kind, nb ) in inventory if kind == "apple" ] ), "apple" )
text "you have [myVar]"
The issue exist even with offline game if you use a save coming from an unknown source.There are implications with eval safety but i believe for an offline renpy game it would only impact if the dev is concerned with cheating, maybe a more versed coder could comment on this.
define numbersOf="sum( [ nb for ( kind, nb ) in inventory if kind == "{}" ] )"
eval( numbersOf.format( "apple" ) )
"makeComputerExplode()\n'{}'\n".eval( numbersOf.format( "apple" ) ), the computer will explode.eval stay relatively limited in range of threat. All the code have to be defined in it, and I'm not sure that it would really be able to deal with something like:eval( "def myFunc( param1, param2 ):\n [malicious code part1]\n return boom;dangerousThing( myFunc( {}, {} ) )\n" )Wow, not so versed coder even less in Renpy internal works, didn't though about the possibility trought saves, but as you said, at that point it would be more of an user mistake.The issue exist even with offline game if you use a save coming from an unknown source.
Lets say that you have:
Someone malicious can perfectly use the console to change the value of "numbersOf" toPython:define numbersOf="sum( [ nb for ( kind, nb ) in inventory if kind == "{}" ] )" eval( numbersOf.format( "apple" ) )
something like"makeComputerExplode()\n'{}'\n".
Like the value have changed, the variable is now savable. And like the value is saved, it will be updated for anyone loading this save.
Now, the first time the game will useeval( numbersOf.format( "apple" ) ), the computer will explode.
This being said,evalstay relatively limited in range of threat. All the code have to be defined in it, and I'm not sure that it would really be able to deal with something like:
eval( "def myFunc( param1, param2 ):\n [malicious code part1]\n return boom;dangerousThing( myFunc( {}, {} ) )\n" )
And, obviously, since Pickles itself is a possible threat, Ren'Py saves are now a bit more secured. If the player decided to bypass the restriction regarding third party saves, it's is responsibility.