Code: Select all
label TeachingDone:
python:
if InTeaching == "Skill1":
UsedSkill = "Skill1"
elif InTeaching == "Skill2":
UsedSkill = "Skill2Value"
elif InTeaching == "Skill3":
UsedSkill = "Skill3Value"
else:
pass
call screen teaching_doneCode: Select all
screen teaching_done:
tag mains
add "TeachingDone.png" xalign 0.5 yalign 0.5
text "{color=#e86b6b}[InTeaching]{/color}" xpos 900 ypos 35
bar:
value StaticValue(UsedSkill, 10)
xalign 0.52
yalign 0.8
xmaximum 1000
ymaximum 30
left_bar Frame("bar1.png", 10, 0)
right_bar Frame("bar2.png", 10, 0)
thumb NoneWhat interests us here is the StaticValue of the bar.
As we know, StaticValue(UsedSkill) will represent the value of variable called "UsedSkill". However, in the If we stated that UsedSkill's value is either Skill1Value or Skill2Value or SKill3Value, all of them being variables on their own and having integers as values.
I do not want bar to represent UsedSkill variable, I want it to represent variable that is stated as value of UsedSkill variable.
Someone suggested on the stackoverflow using dictionary, so I added it behind If:
Code: Select all
label TeachingDone:
python:
if InTeaching == "Skill1":
UsedSkill = "1"
elif InTeaching == "Skill2":
UsedSkill = "2"
elif InTeaching == "Skill3":
UsedSkill = "3"
else:
pass
dict = {1: 'Skill1Value', 2: 'Skill2Value', 3: 'Skill3Value'}
call screen teaching_doneCode: Select all
screen teaching_done:
tag mains
add "TeachingDone.png" xalign 0.5 yalign 0.5
text "{color=#e86b6b}[InTeaching]{/color}" xpos 900 ypos 35
bar:
value StaticValue(dict[UsedSkill], 10)
xalign 0.52
yalign 0.8
xmaximum 1000
ymaximum 30
left_bar Frame("bar1.png", 10, 0)
right_bar Frame("bar2.png", 10, 0)
thumb NoneI could go around this by making many screens with different bars, each for different value, and then showif them depending on the variables stated by If, but this would be painful as I plan to have more than 3 values and could result in performance issues (As all bars would be present with the showif).