Type variable in the Notepad

Asked by Rafael

Hello,
I'm trying to type a text on the notepad, but I don't know how to type the values of some variables after the texts.

This is my code (it is a looping for a game where I want repeat some dungeon runs and count it):

runs_num = 0
victory_num = 0
defeat_num = 0
rewards_num = 0
sell_num = 0
other_num = 0

while exists("1476079504796.png"):

    click(Pattern("1476126302623.png").targetOffset(-144,29)) #click on notepad
    type("Runs = ", runs_num)
    type("Victory = ", victory_num)
    type("Defeat = ", defeat_num)
    type("Rewards = ", rewards_num)
    type("Sell = ", sell_num)
    type ("Pergaminhos, rainbowmons, etc. = ", other_num)

    wait(Pattern("1476071795115.png").similar(0.67), 10) #start run
    click(Pattern("1476071795115.png").similar(0.67))

    runs_num = runs_num + 1

    if exists(Pattern("1476074448503.png").similar(0.75).targetOffset(0,158), 220): #click on victory screen
        victory_num = victory_num + 1

.................... and repeat cycle

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

#convert to strings from numeric, then paste strings

#[Example1:]
num = 123
str_num = 'num = {:d}'.format(num)
paste(str_num)

#[Example2:]
num = 456
str_num = 'num = %d' % num
paste(str_num)

Can you help with this problem?

Provide an answer of your own, or ask Rafael for more information if necessary.

To post a message you must log in.