This is where active bugs can be seen and where to post a new bug.

VGUI - Button Custom Hooks (scene script)

VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 21 May 2017, 00:28

I have had a little play with a 3D menu type of thing, the idea is when you hover over a button it moves the camera via a path for a smooth transition to another angle.

I am using the custom mouse over hook for a button using the VGUI editor with the command lua(scenescript, movecamera, 1)

In the scene there is a camera (2d Fixed) as the main camera, when the mouse cursor is hovered over the button in the GUI it should get the camera (ID = 3) to move one the NewGame Path at a speed of 0.1 but it does nothing.

Working on the basis that in the custom hooks lua(objID, function, arg) is the way to go.

Code: Select all
function movecamera(item)
   if(item == "1") then
      sky.lprint("Move Camera to Path NEW GAME");             -- Left for debugging
      entity.followPath(3, "NewGame", 0.1);                   -- Move Camera on NewGame Path at 0.1 speed
   end
end


To think about it, it is not getting to the sky.lprint line...

I have not tried tried having a script on the camera yet just tried it in the scene script...

will try it when I get time... :)
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 21 May 2017, 18:05

have you tried:
Code: Select all
function movecamera(item)
   lprint("item = "..item);
end


i also think the function needs the entityID argument like:
Code: Select all
function movecamera(eid, item)
   lprint("item = "..item);
end
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 22 May 2017, 08:01

Will try later but on the scene script it's not even printing in the console so it's not running that function, I am thinking it's not possible to use the scene script in this way with the custom hooks?
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 22 May 2017, 12:35

yes, it works fine as i tested it a couple days ago although i used the onclick event or onmousedown, havent tried the hover personally, but i cant see it being any different :)

I will test again when i have some time free :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 22 May 2017, 14:54

Added a script to the camera (has a id of 3) it runs thescript but when using the ID "scenescript" it does not work. :)
also does the same on mouseOut.

Its bringing up ERROR: Entity ID [-1] is not valid! for the command lua(3, movecamera, 1)

The Camera has ID = 3
Function = movecamera
Arg = 1

I also tried passing the ID of the camera through as an argument and the error persists.

I also deleted the contents of movecamera function and only left the sky.lprint("Move Camera to Path NEW GAME"); for debugging and it still shows the Error.

If I take the lua(objID, movecamera, 1) command from the custom hooks the error disappears but when put back shows the error..

Hope you understood all that, basically with a empty function called when you mouseOver, mouseOut etc and running the lua(objID, movecamera, 1) command in the custom hooks results in an error.
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 22 May 2017, 16:43

to use the objID in the lua hook you have to pass the objID into the gui.load() as the last argument:
Code: Select all
gui.load("file.rml", 0, 0, obj);


Also, for scenescript, try passing -9 as that is the id for scenescript.

Hope this helps and will give it a try when this machine stops breaking on me lol :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 22 May 2017, 18:27

This could get messy if you want multiple camera positions on a menu.. lol.. say 1 for 1 menu another for settings another for credits etc.. never mind with think of somethgin else to plod on with lol..

Tried gui.load("file.rml", 0, 0, -9); did not work.. :{
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 22 May 2017, 20:01

the last argument was for the entity id that would be loaded in an entity script.. sorry, i should have been clearer.
I have 1 bug to sort out tomorrow and ill plan this in directly after that task :)

We will come up with a good way of handling it :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 23 May 2017, 08:47

Menus like this or in particular the 2nd one..

Just that little touch on the menus make them look and feel so much better.

I think that this is a feature people would use
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby planetX » 23 May 2017, 12:56

Hi, those menus are totally doable in Skyline right now... you just need to make a model of each menu item, and the camera movement is pretty much what I'm doing in my project, so no secrets there. :)

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Contributor
Skyline Contributor
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: VGUI - Button Custom Hooks (scene script)

Postby epsilonion » 23 May 2017, 17:13

I wanted to use paths with a camera but it's not doable with paths instead of having loads of cameras only use one and assign it a path for each movement.. that's how easy using paths could be, having issues with attaching (assining) a path and passing the ID of the camera to the script to assign the path through the visual gui system at the moment, got to test these things lol

Basically lay out a scene the way you want it add a camera, a few paths, a tiny bit of code and a gui via the visual gui editor using custom hooks that's the simplest way I can think of and none of us like things to be hard lol or is that been lazy lol
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 23 May 2017, 17:39

i am having a look at using paths with the GUI system atm, but that second menu system that you like in the video you posted could be done the same way as planetX using a vector3 lerp from position to position for the camera and a rotation to rotation using the quat.slerp() function to make it point in another direction. No paths really needed for this.. whereas the mountain at the start of the video would need a path to rotate backwards around the path to get to the menu position.

Ill see what i can come up with and see what problems are encountered along the way.

Edit: First tests:
I have a scene script with this function:
Code: Select all
function myfunction(  path )
   if(path == "new_game")then
      lprint("new game selected");
   elseif(path == "options")then
      lprint("options selected");
   elseif(path == "exit")then
      lprint("exit selected");
   end
end


which is called from the onclick hook using these 3 buttons events:
Code: Select all
lua(sceneScript,myfunction,new_game);
lua(scenescript,myfunction,options);
lua(scenescript,myfunction,exit);


These print into the console when used.

Second Test: Shifting the exit one to the mouse over hook also triggers the function.
However, the hover needs to be moved over the top of it in order to keep activating, therefore i recommend using a mouse out hook to know when you have left the button and use the update loop to handle the camera movement or whatever happens
when hovering :)

Third Test:
I can see how the paths seem difficult considering there is no lua code to control cameras on paths from the lua camera.library(). It does seem pointless to make them use an entity follow path since they have their own inbuilt path system, so i will be adding the commands to control paths in the camera lua. This should make it easier.
I will also be adding a camera.hasReachedDestination() function to know when the camera is at the end of that path to tell the system to display next menu or whatever needs to be done lol :P

For now, as mentioned before, just use a position lerp between 2 points and a slerp between 2 rotations.
My advice would be to add an object at the positions of where the end positions are and use a single starting point. Use the editor to orient the meshes in the correct direction, then turn their visibility off and use grab their positions, orientations in code, then blend between.. Its easier than it sounds lol :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby planetX » 23 May 2017, 18:01

SolarPortal wrote:but that second menu system that you like in the video you posted could be done the same way as planetX using a vector3 lerp from position to position for the camera and a rotation to rotation using the quat.slerp() function to make it point in another direction.


Simpler than that: I've used a null object as target, and moved the target together with the cam. :D

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Contributor
Skyline Contributor
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 23 May 2017, 18:31

@planetX, yeah, thats a simple way :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 23 May 2017, 22:16

Currently, i have added these functions to the camera lua library.

These functions work on the current camera used and the current path its following so you dont need to pass any ids or anything apart from the values.
Code: Select all
camera.setReverse( state );
state = camera.isReverse();      
speed = camera.getMoveSpeed();      
camera.setMoveSpeed( speed);      
pathname = camera.getCurrentPath( state );      
camera.setCurrentPath( pathname);      
idx = camera.getCurrentNode( );   
camera.setCurrentNode( idx);   
state = camera.isDestinationReached();
firstNode = camera.getFirstNode( );      
lastNode = camera.getLastNode( );

-- Stop the path updating or make it follow the path again. Great for pausing the movement and continuing again.
state = camera.isUpdatingPath();
camera.setPathUpdating(state);
   


I am currently testing the functions, but so far it seems to be working. Paths are maybes not as smooth as they could be for single line paths, but it does seem to work :)
These will be in the next update.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby Shando » 03 Oct 2017, 02:57

Hi SP,

I know this is an old thread, but I'm getting the same error using the "Custom - Mouse Over" hook:

Code: Select all
ERROR: Entity ID [-1] is not valid!


This appears 3 times in the console.

I've tried the following:

Code: Select all
lua(SceneScript,mouseOver,btnCont1)
lua(-9,mouseOver,btnCont1)
lua(SceneScript,mouseOver,"btnCont1")
lua(-9,mouseOver,"btnCont1")


and get the same error each time, with no other print to the console (I've added an lprint as the first line in the mouseOver function)?

Thanks in advance

Shando

PS: Just tried by moving my "click" function from the "Click Properties" section to the "Custom - onClick" and I get the same error as above when clicking on the button. This works fine when in the "Click Properties" section.

PPS: Also, had to type "SceneScript" for the custom hook to get it to do anything, whereas "scenescript" works fine for the "Click Properties". Just thought I'd point it out as it's something that could confuse users ( well, it confused me :? ).
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 03 Oct 2017, 10:17

yeah, that naming convention needs looked at lol :P

Will check it out today :)

Edit: "sceneScript" or "scenescript" are the supported tags for that.
I have added "SceneScript" and "-9" lol :P

To target an entity script instead of sceneScript, you can use the tags:
"objid", "objID", "eID" or "eid"

but when loading the GUI in lua, you must pass the id of the entity through the last optional argument of gui.load()
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby Shando » 03 Oct 2017, 11:47

Edit: "sceneScript" or "scenescript" are the supported tags for that.
I have added "SceneScript" and "-9" lol


Phew! At least it was something relatively simple :D and not my programmer's brain affliction :lol:

Thanks

Shando
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 03 Oct 2017, 11:59

lol :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: VGUI - Button Custom Hooks (scene script)

Postby SpiderMack » 03 Oct 2017, 12:04

SolarPortal wrote:Edit: "sceneScript" or "scenescript" are the supported tags for that.
I have added "SceneScript" and "-9" lol :P


Should not "-9" value beeing declared as a global lua constant, for example "SceneScriptID" ?
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: VGUI - Button Custom Hooks (scene script)

Postby SolarPortal » 03 Oct 2017, 12:42

Probably should be, if not already... will have to look for one lol :P

But the referred bits here are the GUI Editor and the tags that can be used to pass a lua command from GUI click.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Active / New Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron