Optiks Posted August 22, 2018 Share Posted August 22, 2018 (edited) / Edited August 22, 2018 by Optiks Link to comment
Scripting Moderators thisdp Posted August 22, 2018 Author Scripting Moderators Share Posted August 22, 2018 14 hours ago, Optiks said: / wot? Link to comment
JeViCo Posted August 22, 2018 Share Posted August 22, 2018 Hello! Could you add something like css border-radius property? It'll be awesome having rounded buttons, window, gridlist corners Link to comment
Scripting Moderators thisdp Posted August 23, 2018 Author Scripting Moderators Share Posted August 23, 2018 6 hours ago, JeViCo said: Hello! Could you add something like css border-radius property? It'll be awesome having rounded buttons, window, gridlist corners This requires shader Link to comment
JeViCo Posted August 23, 2018 Share Posted August 23, 2018 5 hours ago, thisdp said: This requires shader that's sad :c Link to comment
Scripting Moderators thisdp Posted August 23, 2018 Author Scripting Moderators Share Posted August 23, 2018 2 hours ago, JeViCo said: that's sad :c dx function is still limited compared with html Link to comment
JeViCo Posted September 14, 2018 Share Posted September 14, 2018 @thisdp Hello again) Could you help me? function scr(new, old) if source == dgsGridListGetScrollBar(gridlist)[1] then dgsGridListSetScrollPosition(gridlist,old) end end addEventHandler("onDgsScrollBarScrollPositionChange",root,scr) i tried to make something like cancelEvent() but dgs resource gives an error: "C stack overflow" 1 Link to comment
edge Posted September 14, 2018 Share Posted September 14, 2018 (edited) Hello. I have several problems on my server with this interface. I've updated the resource already with the command (/updatedgs) or re-uploading the downloaded files from GitHub. When I'm clicking a button which has an handler ("onDgsMouseClick"), executes the function twice. Has anyone this problem like me? I'd like to resolve it. exports.DGS:dgsCreateButton(301, 111, 481, 40, "Register", false, login[4], tocolor(255, 255, 255,255), false, false, false, false, false, tocolor(240, 181, 0,255), tocolor(0, 0, 0,255), tocolor(240, 181, 0,255)) Thanks! Regards, @edge Edited September 14, 2018 by edge Link to comment
Scripting Moderators thisdp Posted September 15, 2018 Author Scripting Moderators Share Posted September 15, 2018 function scr(new, old) if source == dgsGridListGetScrollBar(gridlist)[1] then local vertical = dgsGridListGetScrollPosition(gridlist) if vertical ~= old then dgsGridListSetScrollPosition(gridlist,old) end end end addEventHandler("onDgsScrollBarScrollPositionChange",root,scr) 9 hours ago, edge said: Hello. I have several problems on my server with this interface. I've updated the resource already with the command (/updatedgs) or re-uploading the downloaded files from GitHub. When I'm clicking a button which has an handler ("onDgsMouseClick"), executes the function twice. Has anyone this problem like me? I'd like to resolve it. exports.DGS:dgsCreateButton(301, 111, 481, 40, "Register", false, login[4], tocolor(255, 255, 255,255), false, false, false, false, false, tocolor(240, 181, 0,255), tocolor(0, 0, 0,255), tocolor(240, 181, 0,255)) Thanks! Regards, @edge https://wiki.multitheftauto.com/wiki/OnDgsMouseClick read the bold text in "state" carefully 1 1 Link to comment
JeViCo Posted September 15, 2018 Share Posted September 15, 2018 (edited) 3 hours ago, thisdp said: function scr(new, old) if source == dgsGridListGetScrollBar(gridlist)[1] then local vertical = dgsGridListGetScrollPosition(gridlist) if vertical ~= old then dgsGridListSetScrollPosition(gridlist,old) end end end addEventHandler("onDgsScrollBarScrollPositionChange",root,scr) same :с Edited September 15, 2018 by JeViCo Link to comment
JeViCo Posted September 15, 2018 Share Posted September 15, 2018 (edited) Also this code f = addEventHandler("OnDgsGridListSelect",getRootElement(),chooseStickGrid) print(f) always returns false and of course chooseStickGrid function doesn't work. I tried to put gridlist variable instead of getRootElement() but got same result and FINALLY gridlist sort "#"..number items like this and i can't understand how to fix it Edited September 15, 2018 by JeViCo Link to comment
Scripting Moderators thisdp Posted September 15, 2018 Author Scripting Moderators Share Posted September 15, 2018 2 hours ago, JeViCo said: Also this code f = addEventHandler("OnDgsGridListSelect",getRootElement(),chooseStickGrid) print(f) always returns false and of course chooseStickGrid function doesn't work. I tried to put gridlist variable instead of getRootElement() but got same result and FINALLY gridlist sort "#"..number items like this and i can't understand how to fix it Event Name: On*** -> on*** use custom sort function 1 Link to comment
JeViCo Posted September 15, 2018 Share Posted September 15, 2018 21 minutes ago, thisdp said: Event Name: On*** -> on*** oops, my fault 22 minutes ago, thisdp said: use custom sort function i have some difficulties with it. I guess i'm totally wrong here local sortfnc = [[ local arg = {...} local a = arg[1] local b = arg[2] local column = dgsElementData[self].sortColumn local texta,textb = a[column][1],b[column][1] local texta,textb = tonumber(string.gsub(texta,"%#","")),tonumber(string.gsub(textb,"%#","")) return texta < textb ]] Link to comment
Scripting Moderators thisdp Posted September 15, 2018 Author Scripting Moderators Share Posted September 15, 2018 (edited) 23 minutes ago, JeViCo said: oops, my fault i have some difficulties with it. I guess i'm totally wrong here local sortfnc = [[ local arg = {...} local a = arg[1] local b = arg[2] local column = dgsElementData[self].sortColumn local texta,textb = a[column][1],b[column][1] local texta,textb = tonumber(string.gsub(texta,"%#","")),tonumber(string.gsub(textb,"%#","")) return texta < textb ]] here is an example local sortfnc = [[ local arg = {...} local a = arg[1] local b = arg[2] local column = dgsElementData[self].sortColumn local texta,textb = a[column][1],b[column][1] local texta,textb = tonumber(texta:sub(2)),tonumber(textb:sub(2)) print(texta,textb) return texta < textb ]] gridlist = dgsCreateGridList(300,50,600,600,false) dgsGridListAddColumn(gridlist,"test1",0.2) for i=1,50 do local row = dgsGridListAddRow(gridlist) dgsGridListSetItemText(gridlist,row,1,"#"..tostring(i)) end dgsGridListSetSortEnabled(gridlist,false) --disable click sorting dgsGridListSetSortFunction(gridlist,sortfnc) dgsGridListSetSortColumn(gridlist,1) 5 hours ago, JeViCo said: same :с I have just released DGS 3.393 You can use dgsScrollBarSetLocked to lock the position dgsScrollBarSetLocked(scrollbar,state) Edited September 15, 2018 by thisdp 1 Link to comment
JeViCo Posted September 15, 2018 Share Posted September 15, 2018 23 minutes ago, thisdp said: here is an example local sortfnc = [[ local arg = {...} local a = arg[1] local b = arg[2] local column = dgsElementData[self].sortColumn local texta,textb = a[column][1],b[column][1] local texta,textb = tonumber(texta:sub(2)),tonumber(textb:sub(2)) print(texta,textb) return texta < textb ]] gridlist = dgsCreateGridList(300,50,600,600,false) dgsGridListAddColumn(gridlist,"test1",0.2) for i=1,50 do local row = dgsGridListAddRow(gridlist) dgsGridListSetItemText(gridlist,row,1,"#"..tostring(i)) end dgsGridListSetSortEnabled(gridlist,false) --disable click sorting dgsGridListSetSortFunction(gridlist,sortfnc) dgsGridListSetSortColumn(gridlist,1) click sorting confused me. Thank you 1 Link to comment
JeViCo Posted September 17, 2018 Share Posted September 17, 2018 Could you help me a little bit? (maybe not). Something wrong with my code - 3d menu always facing the wrong way local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000) w_main = dgsCreateWindow(0, 0, 0.32, 0.58, "test window", true) Link to comment
Scripting Moderators thisdp Posted September 17, 2018 Author Scripting Moderators Share Posted September 17, 2018 (edited) 4 hours ago, JeViCo said: Could you help me a little bit? (maybe not). Something wrong with my code - 3d menu always facing the wrong way local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000) w_main = dgsCreateWindow(0, 0, 0.32, 0.58, "test window", true) I just wonder how can you draw a window on 3d interface. set face to nil,nil,nil can give you an always facing to the camera state Edited September 17, 2018 by thisdp 1 Link to comment
JeViCo Posted September 18, 2018 Share Posted September 18, 2018 7 hours ago, thisdp said: I just wonder how can you draw a window on 3d interface. i cut that from my code. I forgot to add dgsSetParent 7 hours ago, thisdp said: set face to nil,nil,nil can give you an always facing to the camera state i tried to add coordinates from getCameraMatrix and getElementPosition - same. I'll try with nil,nil,nil 1 Link to comment
Scripting Moderators thisdp Posted September 18, 2018 Author Scripting Moderators Share Posted September 18, 2018 9 hours ago, JeViCo said: i cut that from my code. I forgot to add dgsSetParent i tried to add coordinates from getCameraMatrix and getElementPosition - same. I'll try with nil,nil,nil face to of dgs 3d interface is offset relative to the position of 3d interface such as face to 1,0,0 the absolute position is x+1,y,z Link to comment
JeViCo Posted September 18, 2018 Share Posted September 18, 2018 (edited) 44 minutes ago, thisdp said: face to of dgs 3d interface is offset relative to the position of 3d interface such as face to 1,0,0 the absolute position is x+1,y,z i didn't know about that, thanks! p.s. i've just tested those offsets and they don't work for me (at all) addCommandHandler("ttt",function(cmd,amount) local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,tonumber(amount),r) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) end) i thought i can rotate those menus using offsets and player rotation but all of them Could you add something like camera position settings then? 1. Menu always facing towards the player (dynamic world position) 2. Menu always facing towards the single point (static world position) Edited September 18, 2018 by JeViCo Link to comment
Scripting Moderators thisdp Posted September 19, 2018 Author Scripting Moderators Share Posted September 19, 2018 (edited) 9 hours ago, JeViCo said: i didn't know about that, thanks! p.s. i've just tested those offsets and they don't work for me (at all) addCommandHandler("ttt",function(cmd,amount) local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,tonumber(amount),r) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) end) i thought i can rotate those menus using offsets and player rotation but all of them Could you add something like camera position settings then? 1. Menu always facing towards the player (dynamic world position) 2. Menu always facing towards the single point (static world position) so I told you, set "Face To" to nil,nil,nil https://wiki.multitheftauto.com/wiki/DgsCreate3DInterface If you want to face to a point, use pointPosition-3dInterfacePosition Edited September 19, 2018 by thisdp Link to comment
JeViCo Posted September 19, 2018 Share Posted September 19, 2018 12 hours ago, thisdp said: so I told you, set "Face To" to nil,nil,nil addCommandHandler("ttt",function() local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) end) Link to comment
Daniels69 Posted September 19, 2018 Share Posted September 19, 2018 1 hour ago, JeViCo said: addCommandHandler("ttt",function() local x, y, z = getElementPosition ( localPlayer ) local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) end) dgsSetProperty(interface,"faceTo",{faceTowardsX,faceTowardsY,faceTowardsZ}) Link to comment
JeViCo Posted September 19, 2018 Share Posted September 19, 2018 18 minutes ago, Daniels69 said: dgsSetProperty(interface,"faceTo",{faceTowardsX,faceTowardsY,faceTowardsZ}) same addCommandHandler("ttt",function() local x, y, z = getElementPosition ( localPlayer ) local px,py,pz = x,y,z local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) dgsSetProperty(d3,"faceTo",{px,py,pz}) end) Link to comment
Scripting Moderators thisdp Posted September 19, 2018 Author Scripting Moderators Share Posted September 19, 2018 20 minutes ago, JeViCo said: same addCommandHandler("ttt",function() local x, y, z = getElementPosition ( localPlayer ) local px,py,pz = x,y,z local _,_,r = getElementRotation ( localPlayer ) x = x - math.sin ( math.rad ( r ) ) * 2 y = y + math.cos ( math.rad ( r ) ) * 2 d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil) w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false) dgsSetParent(w_main,d3) dgsSetProperty(d3,"faceTo",{px,py,pz}) end) sry, it's my fault, updatedgs But it seems there is still a problem. I will fix it later Thank you 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