Jump to content

Skipping the if statement?


Recommended Posts

It's very simple. Once you press the button, it must check if the number is between 1 and 5 and if it is, it changes the value up or down. But when I press the button and I have reached 5, it still adds 1.

  
    charname = guiGetText(edtchar) 
    str=guiGetText(strskl) 
    def=guiGetText(defskl) 
    int=guiGetText(intskl) 
    sta=guiGetText(staskl) 
    han=guiGetText(hanskl) 
    inv=guiGetText(invskl) 
    wep=guiGetText(wepskl) 
    res=guiGetText(resskl) 
    local total = tonumber(str+def+int+sta+han+inv+wep+res) 
    if (source==btnstrm) then 
        if ((tonumber(str)>0) or (tonumber(str)<6)) then 
            guiSetText(strskl, tonumber(str-1)) 
            outputChatBox(str) 
        end 
    elseif (source==btnstrp) then 
        if (tonumber(str)>0 or tonumber(str)<6) then 
            guiSetText(strskl, tonumber(str+1)) 
        end 
    elseif (source==btndefm) then 
        if (tonumber(def)>0 or tonumber(def)<6) then 
            guiSetText(defskl, tonumber(def-1)) 
        end 
    elseif (source==btndefp) then 
        if (tonumber(def)>0 or tonumber(def)<6) then 
            guiSetText(defskl, tonumber(def+1)) 
        end 
    elseif (source==btnintm) then 
        if (tonumber(int)>0 or tonumber(int)<6) then 
            guiSetText(intskl, tonumber(int-1)) 
        end 
    elseif (source==btnintp) then 
        if (tonumber(int)>0 or tonumber(int)<6) then 
            guiSetText(intskl, tonumber(int+1)) 
        end 
    elseif (source==btnstam) then 
        if (tonumber(sta)>0 or tonumber(sta)<6) then 
            guiSetText(staskl, tonumber(sta-1)) 
        end 
    elseif (source==btnstap) then 
        if (tonumber(sta)>0 or tonumber(sta)<6) then 
            guiSetText(staskl, tonumber(sta+1)) 
        end 
    elseif (source==btnhanm) then 
        if (tonumber(han)>0 or tonumber(han)<6) then 
            guiSetText(hanskl, tonumber(han-1)) 
        end 
    elseif (source==btnhanp) then 
        if (tonumber(han)>0 or tonumber(han)<6) then 
            guiSetText(hanskl, tonumber(han+1)) 
        end 
    elseif (source==btninvm) then 
        if (tonumber(inv)>0 or tonumber(inv)<6) then 
            guiSetText(invskl, tonumber(inv-1)) 
        end 
    elseif (source==btninvp) then 
        if (tonumber(inv)>0 or tonumber(inv)<6) then 
            guiSetText(invskl, tonumber(inv+1)) 
        end 
    elseif (source==btnwepm) then 
        if (tonumber(wep)>0 or tonumber(wep)<6) then 
            guiSetText(wepskl, tonumber(wep-1)) 
        end 
    elseif (source==btnwepp) then 
        if (tonumber(wep)>0 or tonumber(wep)<6) then 
            guiSetText(wepskl, tonumber(wep+1)) 
        end 
    elseif (source==btnresm) then 
        if (tonumber(res)>0 or tonumber(res)<6) then 
            guiSetText(resskl, tonumber(res-1)) 
        end 
    elseif (source==btnresp) then 
        if (tonumber(res)>0 or tonumber(res)<6) then 
            guiSetText(resskl, tonumber(res+1)) 
        end 
    end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...