Jump to content

FSXTim

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by FSXTim

  1. No errors, when I enter /debugscript. Greets
  2. Hello, I have a problem with my script. The script: function input1 (state) if state == "left" then if source == sud2 then inputb1 = guiCreateButton(0.85,0.1600,0.0727,0.0545,"1",true,sudoku_Window) if source == inputb1 then guiSetText(sud2, "1") end end end end addEventHandler("onClientGUIClick", getRootElement(), input1) This part of the script doesn't work (the text of the label is not changed to '1'): if source == inputb1 then guiSetText(sud2, "1") end Greets
  3. #Edit: I found a solution: function checkSod (state) if state == "left" then if source == sodButton1 then if guiGetText(sod1) == "1" then outputChatBox("Test") end end end end addEventHandler("onClientGUIClick", getRootElement(), checkSod) Thanks at all! Greets
  4. This also doesn't work. The script: x,y = guiGetScreenSize() sudoku_Window = guiCreateWindow(x/10.0 - 110,y/2.5 - 165,220,330,"",false) sodButton1 = guiCreateButton(0.0909,0.7182,0.2409,0.0515,"Prüfen",true,sudoku_Window) guiSetFont(sodButton1,"default-bold-small") sod1 = guiCreateLabel(0.2200,0.1500,0.0455,0.0485,"1",true,sudoku_Window) function checkSod ( button, state ) if ( source == sodButton1 ) then if ( guiGetText ( sod1 ) == "1" ) then outputChatBox ( "Test" ) end end end addEventHandler ( "onClientGUIClick", guiRoot, checkSod ) Greets
  5. And what do I exactly have to do now? Greets
  6. function checkSod ( button, state ) if (state == "left") then if (source == sodButton1) then if (guiGetText(sod1 ) == "1") then outputChatBox ("Test") end end end end addEventHandler ("onClientGUIClick", getRootElement(), checkSod) Now the chatbox doesn't say anything although the text in the label is '1'! Greets
  7. No errors in the debugscript. This doesn't work: sod1 = guiCreateLabel(0.2200,0.1500,0.0455,0.0485,"1",true,sudoku_Window) function checkSod (state) if state == "left" then if source == sodButton1 then if guiGetText(sod1) == "1" then local player = getLocalPlayer() outputChatBox("Test", player) end end end end addEventHandler("onClientGUIClick", getRootElement(), checkSod) But this works: function checkSod (state) if state == "left" then if source == sodButton1 then sod1 = guiCreateLabel(0.2200,0.1500,0.0455,0.0485,"1",true,sudoku_Window) if guiGetText(sod1) == "1" then local player = getLocalPlayer() outputChatBox("Test", player) end end end end addEventHandler("onClientGUIClick", getRootElement(), checkSod) But I need to make it working with the first way. Greets
  8. Hello, if the player press the button 'sodButton1' and the text of the label is '1', the outputChatBox has to say 'Test', but it doesn't, although the text of the label is '1'. sod1 = guiCreateLabel(0.2200,0.1500,0.0455,0.0485,"1",true,sudoku_Window) function checkSod (state) if state == "left" then if source == sodButton1 then if guiGetText(sod1) == "1" then local player = getLocalPlayer() outputChatBox("Test", player) end end end end addEventHandler("onClientGUIClick", getRootElement(), checkSod) Greets
  9. Thanks for your help, you took a lot of time to help me, thanks, you are great! Everything is working now. I didn't give you the labels/buttons, which are not important for calculator script. Greets
  10. This doesn't work completly, I changed something: function addTextInFild (Number) local zwText = guiGetText(zwischeneingabe) if not(zwText == "") then guiSetText (eingabe2,""..Number.."") outputDebugString("eingabe1") else guiSetText (eingabe1,""..guiGetText(eingabe2)..""..Number.."") outputDebugString("eingabe2") end end It works now, but the problem is, that I cannot enter more then one number in 'eingabe1' and 'eingabe2'! I hope you can help me one more time again. Greets
  11. 11 = eingabe1 + = zwischeneingabe (couldn't enter) = einagbe2 the long line = ergebnis Greets
  12. I already tried, and then: 'C1' 'Ze nil' 'Function Number 1' But the numbers are in 'eingabe1' and not in 'eingabe2'! Greets
  13. Can you give me the correct code, please? Because I do not fully understand what you mean! Greets
  14. It's a Edit, here is the full code: x,y = guiGetScreenSize() rechner_Window = guiCreateWindow(x/10.0 - 110,y/2.5 - 165,220,330,"",false) c1 = guiCreateButton(0.1636,0.3333,0.1455,0.0939,"1",true,rechner_Window) cPlus = guiCreateButton(0.6909,0.3333,0.1455,0.0939,"+",true,rechner_Window) cMinus = guiCreateButton(0.6909,0.4455,0.1455,0.0939,"-",true,rechner_Window) cMal = guiCreateButton(0.6909,0.5606,0.1455,0.0939,"x",true,rechner_Window) cRefresh = guiCreateButton(0.3364,0.6758,0.1455,0.0939,"C",true,rechner_Window) cDurch = guiCreateButton(0.6909,0.6758,0.1455,0.0939,"/",true,rechner_Window) cGleich = guiCreateButton(0.5136,0.6758,0.1455,0.0939,"=",true,rechner_Window) eingabe1 = guiCreateEdit(0.1636,0.1182,0.2727,0.0758,"",true,rechner_Window) guiEditSetReadOnly(eingabe1,true) guiEditSetMaxLength(eingabe1,10) eingabe2 = guiCreateEdit(0.5682,0.1182,0.2727,0.0758,"",true,rechner_Window) guiEditSetMaxLength(eingabe2,10) guiEditSetReadOnly(eingabe2,true) guiEditSetMaxLength(eingabe2,10) zwischeneingabe = guiCreateEdit(0.4409,0.1182,0.1182,0.0758,"",true,rechner_Window) guiEditSetReadOnly(zwischeneingabe,true) ergebnis = guiCreateEdit(0.1636,0.203,0.6773,0.0758,"",true,rechner_Window) guiEditSetReadOnly(ergebnis,true) function rZeichen (state) if state == "left" then if(source == cPlus) then guiSetText(zwischeneingabe,"+") elseif(source == cMinus) then guiSetText(zwischeneingabe,"-") elseif(source == cMal) then guiSetText(zwischeneingabe,"x") elseif(source == cDurch) then guiSetText(zwischeneingabe,"/") end end end addEventHandler("onClientGUIClick", getRootElement(), rZeichen) function rechnerKlick (state) if state == "left" then if (source == cRefresh) then guiSetText(eingabe1,"") guiSetText(eingabe2,"") guiSetText(zwischeneingabe,"") guiSetText(ergebnis,"") outputDebugString("Refresh") elseif (source == c1) then outputDebugString("C1") local ze = guiGetText(zwischeneingabe) if ze ~= "" or ze ~= nil then outputDebugString("Ze nil") number1("1") else number2("1") outputDebugString("Ze not nil") end end end end addEventHandler("onClientGUIClick", getRootElement(), rechnerKlick) function number1 (number1) local text = guiGetText(eingabe1) guiSetText (eingabe1,""..text..""..number1.."") outputDebugString("Function Number1") end function number2 (number2) local text = guiGetText(eingabe2) guiSetText (eingabe2,""..text..""..number2.."") outputDebugString("Function Number2") end Greets
  15. If I don't enter a arithmetic operator, the debugstring sais that: 'C1' 'Ze nil' 'Function Number 1' If I enter a arithmetic operator, the debugstring sais that: 'C1' 'Ze nil' 'Function Number 1' The same! Greets
  16. Em, it's still not working: Same function, but the different ways. 1. When the player doesn't enter a arithmetic operator and press the Button 'c1', then ... 2. When the player enter a arithmetic operator and press the Button 'c1', then ... Do you understand me? Greets
  17. Yes, because it's the same button! Greets
  18. Hello, I have some problems with my calculator script. When the player enter a arithmetic operator (it calls 'zwischeneingabe in my script), the new numbers, which the player enter, have to be in the second edit ('eingabe2'), but the numbers are entered in the first edit ('eingabe1') function rechnerKlick (state) if state == "left" then if source == cRefresh then guiSetText(eingabe1,"") guiSetText(eingabe2,"") guiSetText(zwischeneingabe,"") guiSetText(ergebnis,"") end local ze = guiGetText(zwischeneingabe) if ze ~= "" or ze ~= nil then if(source == c1) then number1("1") end else if(source == c1) then number2("1") end end end end addEventHandler("onClientGUIClick", getRootElement(), rechnerKlick) function number1 (number1) local text = guiGetText(eingabe1) guiSetText (eingabe1,""..text..""..number1.."") end function number2 (number2) local text = guiGetText(eingabe2) guiSetText (eingabe2,""..text..""..number2.."") end Greets
  19. FSXTim

    Lua Compiler

    Thanks, sir! Greets
  20. FSXTim

    Lua Compiler

    Hello, I'm looking for a lua compiler, does anybody has one? Greets
  21. @blazy This cannot work, because the label has to be on my window and 'uhrzeit3' is not my window. @Alpha No errors, but no the label sais that: 'Time in' 'London' is missing! Greets
  22. Yea, you're right! Still having a problem: Error (line1): attempt to call glocal 'guiCreateColorLabel' (a nil value) guiCreateColorLabel(0.1494,0.383,0.4689,0.0638,"#FFFFFFTime in #FF0000London",true,zeit_Window) function guiCreateColorLabel( ax, ay, bx, by,str, bool, parent ) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find( pat, 1 ) local last = 1 local r,g,b while s do if cap == "" and col then r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth( cap ) avc321 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end guiLabelSetColor( avc321,r,g,b ) ax = ax + w r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then local cap = str:sub( last ) local w = dxGetTextWidth( cap ) local avc123 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) guiLabelSetColor( avc123,r or 255,g or 255,b or 255 ) return avc123 end end Greets
  23. No, I didn't know them! No, just fun, but I didn't know if it is able to use hex color codes in this function. Thanks! Greets
  24. Okay, thanks! But I don't understand it completely. How would the script look like, if the text in the label is the following? Time in [color=#FF0000]London[/color] 'Time in' is white and 'London' is red. Greets
×
×
  • Create New...