Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AlGrande | |
Old Version | Published before Godot 3 was released. |
When using the str() method in Android I will always get an error.
On Windows everything works fine.
Code:
func update():
Damage = str(global.stats.get_Damage_2(0))
Protection = str(global.stats.get_Protection())
max_Health = str(global.stats.get_Max_Health())
Regeneration = str(global.stats.get_Regeneration())
damage_Mutliplier = str(global.stats.get_Damage_Multiplier())
base_Damage = str(global.stats.get_Base_Damage())
attackspeed_Multiplier = str(global.stats.get_Attackspeed_Multiplier())
Knockback = str(global.stats.get_Knockback())
Level = str(global.stats.get_Level())
var text = "\nLevel: " + Level + "\nDamage Multiplier: " + damage_Mutliplier + "\nBase Damage: " + base_Damage + "\nDamage: " + Damage + "\nAttackspeed Multiplier: " + attackspeed_Multiplier + "\nKnockback: " + Knockback + "\nProtection: " + Protection + "\nMaximum Health: " + max_Health + "\nRegeneration: " + Regeneration
print(text)
#Works: set_text("text")
set_text(text)
Logcat:
I/godot (18564): 25
I/godot (18564): 0
I/godot (18564): 100
I/godot (18564): 0.01
I/godot (18564): 1
I/godot (18564): 25
I/godot (18564): 1
I/godot (18564): 50
I/godot (18564): 1
I/godot (18564): SCRIPT ERROR: update: Invalid operands 'String' and 'Nil' in operator '+'.
I/godot (18564): At: res://scripts/statsLabel.gdc:33.
I’m using the latest nightly(July 10, 2016 at 08:29) of the engine.