Problem with Right Click Menu

Blitz3D Forums/Blitz3D Programming/Problem with Right Click Menu

Guy Fawkes(Posted 2014) [#1]
Hi all. As I near completion of my project, I came across a stand-still. I need the code I made to do the following:

1) Pick the object and turn it transparent.
2) If the object IS transparent, THEN open up right click context menu.


I tried many different ways INCLUDING millisecond timers, but to no avail.

It should CLEARLY make the object transparent and THEN open up the menu.
Not the other way around.

Context_Menu.bb:



Example_Context_Menu.bb:



--=EDIT=--

Note 1: Make sure to change the location of your 3D model (*.x) file, to the correct directory in which your 3D model exists.

Thanks all & have a GREAT afternoon! :)

Sincerely,

~GF


Guy Fawkes(Posted 2014) [#2]
Can someone please assist?

Thank You so kindly! :)

Have a GREAT day! :)

Sincerely,

~GF


RemiD(Posted 2014) [#3]

I need the code I made to do the following


Which means : provide code for my game/app.
But i won't do that because if i do that you will not improve your understanding and skills and you will keep asking the same questions again and again.


1) Pick the object and turn it transparent.


Set the meshes you want to be able to select as pickable
EntityPickMode(Mesh,2)
Also name each of your pickable meshes with a different name or with a listname and an id/handle
NameEntity(Mesh,"dwarf")
or
NameEntity(Mesh,"LISTX"+str(Id))

for each pickable mesh you can store its selection state by having a variable 'SelectionState" which can be true or false

if a key is pressed
Reset all "SelectionState" variables of all pickable meshes to false (except if you need multi selection)
Throw a ray in the world with linepick or camerapick
Check if a pickable mesh has been picked
PickedPickable = PickedEntity()
If(PickedPickable <> 0)
Retrieve the pickable mesh name
PickableName$ = EntityName(PickedPickable)
With its name you can retrieve the list and its id/handle
Knowing the list and its id/handle you can modify the "SelectionState" variable to true
Endif


2) If the object IS transparent, THEN open up right click context menu.


For this you can analyze each entity of the list and if the "SelectionState" variable of a wanted entity is true, display your menu.

To display a menu or any window or any GUI element, i would have a variable "DisplayState" which can be true or false

Depending on the user input you update the different windows and GUI elements and their "DisplayState"

Then when it is time to draw the windows and the GUI elements, depending on the "DisplayState" of each window/GUI element, you know which windows and which GUI elements to draw or not.

Note that i have talked about having a list in case you need to be able to have different meshes in the world, but this will work well with only one mesh too.

2 examples to understand how to set some meshes as pickable and pick them and retrieve the list and the id/handle of a picked pickable :
with types
http://www.blitzbasic.com/codearcs/codearcs.php?code=3095
with arrays :
http://www.blitzbasic.com/codearcs/codearcs.php?code=3094


Guy Fawkes(Posted 2014) [#4]
Thanks RemiD! I will test it tomorrow when I'm not so tired! =)

Cheers! :D

Sincerely,

~GF