Home › Forums › General Questions › How to reference a Verge 3d varible in a Javascript Code Puzzle
- This topic has 26 replies, 5 voices, and was last updated 52 minutes ago by
c4cc.
-
AuthorPosts
-
2025-07-14 at 3:48 pm #83035
c4cc
CustomerUnder console.log, tried to put window.PetraBasicMoveRange under the right side, under JSON3 and under windowprototype, still didn’t work.
Which part of the right side of console log did you put window.PetraBasicMoveRange?
Also tried to write it on the left side, still didn’t work when I went fullscreen
2025-07-14 at 4:27 pm #83039bigmike814
Customerthe part you type in. I see the PetraBasicMoveRange is set in your window as well as the PetraDashRange. You accessed the window and it gave you your window object.
Taking it one step further window.PetraBasicMoveRange should give you the value of your PetraBasicMoveRange key as its set as a key/value in the window object. It’s the same for calling functions or what not.
Thats why you can call functions using v3d.puzzles.procedures, type that in the console and you will see all the procedures you set in the app. thats your address to the object that your procedures are in, so if you put v3d.puzzles.procedures.myFunction (if you have it), it will run that function. Or if it’s an object you can reference or set it that way. Or if you set it = 12 then it should set it.
The window is the map of your app so you can access what you need.
2025-07-14 at 4:45 pm #83040c4cc
Customer2025-07-14 at 5:09 pm #83043c4cc
Customer2025-07-14 at 5:43 pm #83044bigmike814
CustomerOn the first response:
look up v3d.puzzles.procedures and it will give you a list of all the procedures. You can call one of them by typing v3d.puzzles.procedures.theNameOfTheProcedureYouWantToCall
you don’t want to try setting anything to the window with v3d.puzzles.procedures.window…
To set a window object/key you just set window.PetraBasicMove = 12 since you defined this to the window and use it in your procedure, you can set the move rate
window.PetraBasicMove = 12
and then call the function (procedure) that calls the movement.
v3d.puzzles.procedure.movePetra if your function is not setting the speed it uses then it will change the speed.
It’s really hard without seeing what exactly you are trying to accomplish, but just trying to help you understand the concepts.
You have to re-fire the procedure or it wont change.
here are some screenshots of a simple example to conceptualize it.
2025-07-14 at 5:46 pm #83049bigmike814
CustomerHere is another example on how to set the window key petraBasicSpeed value to 12 from the console and then you have two functions that you can call to set it to the defined amount.
Hope this helps
2025-07-14 at 6:24 pm #83052c4cc
Customer2025-07-14 at 6:43 pm #83055bigmike814
CustomerNo problem. Hopefully it makes sense, or at least you can get what you need to get accomplished.
2025-07-14 at 6:52 pm #83056c4cc
Customer2025-07-14 at 7:19 pm #83057bigmike814
Customerjust call the function when the fullscreen is active. or when it is active set the variable to the window and then call the function that changes the speed.
doing it in the console.log is just the easiest way to explain it and you can instantly see what your calling and if it works or not, but what you really want is to use those calls in the code so it can react.
I don’t see why you cant do all of this from the puzzle environment. but its good to get outside of it anyway, for extra learning and incase you need to add more functionality to anything.
I would say the best help you can get is trying chatGPT, if you haven’t yet. It’s not the best for v3d since its puzzles and not code, but if you need code help, it’s great.
2025-07-14 at 7:33 pm #83058c4cc
Customertried in visual studio code, in fullscreen function still no change. Any suggestions?
Wait, so you’re telling me that doing it in console log is not to trigger event, but to see if it works, as in no error?
2025-07-14 at 7:44 pm #83062c4cc
Customerdoing it in the console.log is just the easiest way to explain it and you can instantly see what your calling and if it works or not, but what you really want is to use those calls in the code so it can react.
I don’t see why you cant do all of this from the puzzle environment. but its good to get outside of it anyway, for extra learning and incase you need to add more functionality to anything.
I just think it’s better to put fullscreen button outside verge3d, like that of a youtube video’s. As you say, it’s definitely good to learn more coding for more versatility and flexibility to website or app.
-
This reply was modified 51 minutes ago by
c4cc.
-
This reply was modified 51 minutes ago by
-
AuthorPosts
- You must be logged in to reply to this topic.