Tekken Posted August 19, 2020 Share Posted August 19, 2020 Hi, I'm trying to implement DGS over my GUI scripts and I came to a strange warning, client.lua: 3: Bad argument @ ''addEventHandler" [Expected element at argument 2, got nil] witch is strange that the element exists and the script works just fine while using GUI however this is a simple example of what my script does, actually I'm trying to update a gridlist while typing something into an edit box. local shop = {window = {},edit={}}; addEventHandler("onClientResourceStart", resourceRoot, function() shop.window[1] = dgs:dgsCreateWindow((sW-483)/2, (sH-352)/2, 483, 352, "some window", false, 0xff000000, 25, nil, 0xC800ff00, nil, 0x96141414, 5, false); shop.edit[1] = dgs:dgsCreateEdit(419, 81, 40, 27, "1", false, shop.window[1]); end); addEventHandler("onDgsTextChange", shop.edit[1], function() -- do something... end); Greetings Link to comment
Moderators IIYAMA Posted August 19, 2020 Moderators Share Posted August 19, 2020 1 hour ago, Tekken said: Hi, I'm trying to implement DGS over my GUI scripts and I came to a strange warning onClientResourceStart triggers later than the moment you try to attach the addEventHandler below. 1 Link to comment
Scripting Moderators thisdp Posted August 19, 2020 Scripting Moderators Share Posted August 19, 2020 (edited) Your code doesn't work with GUI. You will get the same warning. local shop = {window = {},edit={}}; addEventHandler("onClientResourceStart", resourceRoot, function() shop.window[1] = dgs:dgsCreateWindow((sW-483)/2, (sH-352)/2, 483, 352, "some window", false, 0xff000000, 25, nil, 0xC800ff00, nil, 0x96141414, 5, false); shop.edit[1] = dgs:dgsCreateEdit(419, 81, 40, 27, "1", false, shop.window[1]); addEventHandler("onDgsTextChange", shop.edit[1], function() -- do something... end,false); end); Edited August 19, 2020 by thisdp 1 Link to comment
Tekken Posted August 19, 2020 Author Share Posted August 19, 2020 (edited) 2 hours ago, thisdp said: Your code doesn't work with GUI. You will get the same warning. local shop = {window = {},edit={}}; addEventHandler("onClientResourceStart", resourceRoot, function() shop.window[1] = dgs:dgsCreateWindow((sW-483)/2, (sH-352)/2, 483, 352, "some window", false, 0xff000000, 25, nil, 0xC800ff00, nil, 0x96141414, 5, false); shop.edit[1] = dgs:dgsCreateEdit(419, 81, 40, 27, "1", false, shop.window[1]); addEventHandler("onDgsTextChange", shop.edit[1], function() -- do something... end,false); end); Ok got it thank you. I actually use a slightly different way but the same principal however that didn’t work with DGS so I try’d like this and I got this warning. Thank you both. I use « onClientGUIClick », resourceRoot, etc and check the source within the function however didn’t updated my gui don’t know why So I should attach it within the create function I’ m I right ? Edited August 19, 2020 by Tekken Link to comment
Scripting Moderators thisdp Posted August 19, 2020 Scripting Moderators Share Posted August 19, 2020 if you are using DGS onClientGUIClick is unusable, use onDgsMouseClick instead, You'd better check wiki otherwise you may confuse this function with onClientGUIClick Link to comment
Tekken Posted August 19, 2020 Author Share Posted August 19, 2020 When I said onClientGUIClick I was talking about GUI, I know DGS won’t work I have read the wiki Link to comment
Scripting Moderators thisdp Posted August 19, 2020 Scripting Moderators Share Posted August 19, 2020 12 minutes ago, Tekken said: When I said onClientGUIClick I was talking about GUI, I know DGS won’t work I have read the wiki I don't recommand you to bind "onClientGUIClick" on resourceRoot, it takes more CPU resource. Don't set the 4th argument to false when binding "onClientGUIClick" on resourceRoot. 1 Link to comment
Tekken Posted August 19, 2020 Author Share Posted August 19, 2020 1 hour ago, thisdp said: I don't recommand you to bind "onClientGUIClick" on resourceRoot, it takes more CPU resource. Don't set the 4th argument to false when binding "onClientGUIClick" on resourceRoot. Thanks I will keep that in mind. 1 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