Mirage Source
Right Click Menu - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Right Click Menu (/showthread.php?tid=2566)



Right Click Menu - addy - 20-02-2009

Ive had a code for a right click menu for awhile now. its pretty easy to make and all just i wanted to give to you since idt ill be programming for awhile now. So here it is lol

In frmMirage make a picturebox called "picRightClick". Set its visible to false.

In ModGlobals add this line anywhere:
Code:
Public RclickIndex as Long
.

In frmMirage's code replace the code "picScreen_MouseDown" with this:
Code:
Dim i As Long

    If Button = 2 Then
        For i = 1 To MAX_PLAYERS
            If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                If GetPlayerX(i) * 32 = x Or x + 32 Then
                    If GetPlayerY(i) * 32 = y Or y + 32 Then
                        frmMirage.picRightClick.Visible = True
                    End If
                End If
            End If
        Next i
    End If
    
    If Button = 1 Then
        Call EditorMouseDown(Button, Shift, x, y)
        Call PlayerSearch(Button, Shift, x, y)
    End If

There it is. I hope it works for all of you


Re: Right Click Menu - Acruno - 20-02-2009

Correct me if I'm wrong, but wouldn't that just show a menu in the same place everytime, i.e. it wouldn't appear where the mouse is.


Re: Right Click Menu - Mattyw - 20-02-2009

I believe so. I don't even get the code, it doesn't make sense.

Code:
Public RclickIndex as Long

That isn't needed, amirite?


Re: Right Click Menu - addy - 20-02-2009

Acutally no.
Ive tried this before.
It gets the x and y of the cursor and then looks threw every player's x and y and sees if the cursor is there. Thats only if its button 2.
Then the rclickindex is needed because if you wanted to add a Invite party thing to menu you just gotta put
SendPartyRequest(RclickiNdex). It sets the index of the menu.


Re: Right Click Menu - Robin - 20-02-2009

addy Wrote:Acutally no.
Ive tried this before.
It gets the x and y of the cursor and then looks threw every player's x and y and sees if the cursor is there. Thats only if its button 2.
Then the rclickindex is needed because if you wanted to add a Invite party thing to menu you just gotta put
SendPartyRequest(RclickiNdex). It sets the index of the menu.

The menu still opens up at the same place.


Re: Right Click Menu - Mattyw - 20-02-2009

Shouldn't it use CurX & CurY?


Re: Right Click Menu - Matt - 20-02-2009

Mattyw Wrote:Shouldn't it use CurX & CurY?

For displaying, yes. But the other is for getting the x/y of the player you right clicked.

It's a very good idea, but it needs to be tweaked a bit still.


Re: Right Click Menu - addy - 20-02-2009

Dam. I only thought CurX and CurY was for Eclipse.
I saw that Eclipse tweaked it and i made it a great script on eclipse.