kevincouto6 Posted November 13, 2018 Share Posted November 13, 2018 Hello, I'm asking for help because I can not specify the message for GindList type ? "Fist Misson" grindList message testing 1. "Second mission" grindList2 message testing 2. "thrind mission" grindList3 message testing 3. This script is Client-side addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) local me = not guiGetVisible (WinMission) if (source == accepted) then if ( guiGridListGetSelectedItem ( ListMissions ) ~= 1 ) then outputChatBox( "Testing 1" ) elseif ( guiGridListGetSelectedItem ( ListMissions ) ~= 2 ) then outputChatBox( "Testing 2" ) elseif ( guiGridListGetSelectedItem ( ListMissions ) ~= 3 ) then outputChatBox( "Testing 3" ) elseif ( guiGridListGetSelectedItem ( ListMissions ) ~= 4 ) then outputChatBox( "Testing 4" ) end end end) If it is possible to help me, no debug currently appears no error ? This script is Client-side addEventHandler("onClientResourceStart", resourceRoot, function () WinMission = guiCreateWindow(356, 141, 594, 329, "Mission", false) guiSetVisible (WinMission, false ) guiWindowSetSizable(WinMission, false) accepted = guiCreateButton(12, 236, 180, 34, "ACCEPTED", false, WinMission) info = guiCreateButton(207, 236, 180, 34, "INFO", false, WinMission) abandon = guiCreateButton(397, 236, 180, 34, "ABANDON", false, WinMission) ListMissions = guiCreateGridList(12, 36, 565, 190, false, WinMission) guiGridListAddColumn(ListMissions, "MISSION", 0.9) for i = 1, 11 do guinumeber = guiGridListAddRow(ListMissions) end guiGridListSetItemText(ListMissions, 0, 1, "Fist Misson", false, false) guiGridListSetItemText(ListMissions, 1, 1, "Seccond Mission", false, false) guiGridListSetItemText(ListMissions, 2, 1, "Trind Mission", false, false) guiGridListSetItemText(ListMissions, 3, 1, "-", false, false) guiGridListSetItemText(ListMissions, 4, 1, "-", false, false) guiGridListSetItemText(ListMissions, 5, 1, "-", false, false) guiGridListSetItemText(ListMissions, 6, 1, "-", false, false) guiGridListSetItemText(ListMissions, 7, 1, "-", false, false) guiGridListSetItemText(ListMissions, 8, 1, "-", false, false) guiGridListSetItemText(ListMissions, 9, 1, "-", false, false) guiGridListSetItemText(ListMissions, 10, 1, "-", false, false) Buttonexit = guiCreateButton(10, 276, 567, 43, "EXIT", false, WinMission) end ) Thx, by the attention? Link to comment
Addlibs Posted November 13, 2018 Share Posted November 13, 2018 (edited) Just some points from the top. First, please note it's called a gridlist, not grindlist. Secondly, your indenting is inconsistent (sometimes you use spaces, other times tabs — just stick to one of them, otherwise it gets ugly when shared on the forum) Now, let's get to some rudimentary debugging. Add debug messages in the code so you can trace the flow of execution (which blocks of code were executed and which weren't), and inspect variables or return values of functions. By the way, in Lua, brackets after if and before then are optional. addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) outputDebugString("onClientGUIClick called.") -- if this is appears in debugscript, that means the event was triggered and this function handled it local me = not guiGetVisible (WinMission) if (source == accepted) then outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions)) -- if this appears in debugscript, that means (source == accepted) is true. if (guiGridListGetSelectedItem(ListMissions) == 1) then outputDebugString("1 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 2) then outputDebugString("2 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 3) then outputDebugString("3 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 4) then outputDebugString("4 was selected") end end end ) Try the code above and report back what you get in /debugscript 3. Edited November 13, 2018 by MrTasty Link to comment
kevincouto6 Posted November 13, 2018 Author Share Posted November 13, 2018 4 minutes ago, MrTasty said: Just some points from the top. First, please note it's called a gridlist, not grindlist. Secondly, your indenting is inconsistent (sometimes you use spaces, other times tabs — just stick to one of them, otherwise it gets ugly when shared on the forum) Now, let's get to some rudimentary debugging. Add debug messages in the code so you can trace the flow of execution (which blocks of code were executed and which weren't), and inspect variables or return values of functions. By the way, in Lua, brackets after if and before then are optional. addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) outputDebugString("onClientGUIClick called.") -- if this is appears in debugscript, that means the event was triggered and this function handled it local me = not guiGetVisible (WinMission) if (source == accepted) then outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions)) -- if this appears in debugscript, that means (source == accepted) is true. if (guiGridListGetSelectedItem(ListMissions) == 1) then outputDebugString("1 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 2) then outputDebugString("2 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 3) then outputDebugString("3 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 4) then outputDebugString("4 was selected") end end end ) Try the code above and report back what you get in /debugscript 3. thx bro Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now