Jump to content

DGS edit box strange warning


Tekken

Recommended Posts

Posted

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

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

  • Moderators
Posted
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.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted (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 by thisdp
Posted (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 by Tekken

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

  • Moderators
Posted

if you are using DGS

onClientGUIClick is unusable, use onDgsMouseClick instead, You'd better check wiki otherwise you may confuse this function with onClientGUIClick

  • Moderators
Posted
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.

Posted
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.

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

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...