Basic Syntax Waitfor 120.0, global fitermstoedit

What am I doing wrong here?
Waitfor 120.0, global fitermstoedit

Comments

  • Hi Bass-O-Matic.

    Your image global fitermstoedit must be in quotation marks as shown below, otherwise eggPlant will treat it as a variable. The correct code is displayed below.
    Waitfor 120.0, "global fitermstoedit"
    

    I hope this helps and thanks for using eggPlant!
  • Sorry, I should have been more clear. It is a variable.
    set global fitermstoedit to "editmfas" -- editmfas is an image
    
    Waitfor 120.0, global fitermstoedit -- this don't work
    
    Click global fitermstoedit -- this works fine
    
    
  • EggplantMattEggplantMatt ForumAdmin admin
    You need to put the variable reference in parentheses so that it becomes an expression to be evaluated:
    Waitfor 120.0, (global fitermstoedit)
    
  • EggplantMattEggplantMatt ForumAdmin admin
    BTW, if you declare a variable as global then you don't need to use the global keyword all the time:
    global fitermstoedit
    put "editmfas" into fitermstoedit -- refers to the global variable
    waitfor 120, fitermstoedit -- refers to the global variable
    
    but just using the variable before declaring it as you did in your example requires that you specify the global keyword whenever you reference it. Note that this also applies when you define a handler and you want to use a previously declared global variable inside it:
    global somevar
    put "armadillo" into somevar
    stewArmadillo
    stuffArmadillo
    
    on stewArmadillo
    	put "jack rabbit" into somevar -- variable local to handler
    	put global somevar -- outputs "armadillo"
    	put somevar -- outputs "jack rabbit"
    end stewArmadillo
    
    on stuffArmadillo
    	global somevar 
    	put somevar -- outputs "armadillo" since somevar has been declared global
    end stuffArmadillo
    

    This is explained in even more excruciating detail in this post.
Sign In or Register to comment.