Mirage Source
Right-click warping - 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 warping (/showthread.php?tid=850)

Pages: 1 2


Right-click warping - Braydok - 27-03-2007

Can someone please post a tutorial for right click warping? I have seen multiple rightclick to move tutorials, but most say they don't work, or are not what I need.
I need a tutorial that when you right click, it warps you there, not walks.

Any help?
~Braydok


- Robin - 28-03-2007

Code:
If button = 2 then
  Call PlayerWarp(x, y, myindex)
end if



- Braydok - 28-03-2007

Um, okay, but would that warp the admin where they click on, on the map?


- Robin - 28-03-2007

Code:
If Player(MyIndex).Access >= 4 then
  If button = 2 then
    Call PlayerWarp(x, y, myindex)
  end if
end if



- Tony - 28-03-2007

Instead of just copy and pasting try understanding the code that Robin simply wrote up.

Code:
If Player(MyIndex).Access >= 4 then ' If Player's access if larger then or equal to 4
  If button = 2 then ' If right click then (next line plx)
    Call PlayerWarp(x, y, myindex) ' call sub to warp
  end if
end if



- Braydok - 30-03-2007

Okay, but I was wondering if the warpplayer(x,y, myindex) or whatever, would warp them to where you click, apparently it did. Thanks. Smile


- Robin - 30-03-2007

Sorry, I should of explained it a bit better. Was feeling a bit off with Tonsillitis.

Basically, when you click on the picScreen PictureBox Control, the subroutine which is called logs many different things.

Including the x and y coordinates of the registered 'click' and the button.

Button 1 is the left mouse button, Button 2 the right and Button 3 the scrolling wheel. (On a standard mouse setup).

What we've done is taken these saved variables and put them into our sub.

So, (I'm guessing that when you click on the picScreen, the subroutine which is already there changes the x and y values to the corresponding 32x32 tiles, because I think we click on the screen for a player search or something), we call the PlayerWarp subroutine (PlayerWarp()) and put these saved variables into the syntax, so we come to.

Code:
PlayerWarp x, y, myindex (the index of the playing character)

Of course, if you wanted to do this serverside, you would use the variable which stores the packet senders index, eg. "index".

So, it would become:

Code:
PlayerWarp x, y, index

You would of course have to send the x and y in a packet, and could then even take the players index from the index of that packet.

Hope that helped explain a bit ^^


- Boo - 30-03-2007

i think he needs the whole sub/packet, not just the click command :x


- Robin - 30-03-2007

Boo Wrote:i think he needs the whole sub/packet, not just the click command :x

Don't look at me like that.

Double click on the picScreen.

I can't give you an entire subroutine because it's already got code in it, and I don't know how much of his code affects it already.


- Boo - 30-03-2007

i hate that smiley code... its : x what im trying to do like "Speechless" :\ sorry lol


- Braydok - 10-04-2007

This might work, other than the fact that that the client does not have a playerwarp code.


- Robin - 10-04-2007

Braydok Wrote:This might work, other than the fact that that the client does not have a playerwarp code.

Then send a packet to the server.


- Braydok - 10-04-2007

I tried, but how do you send the x and y that you got to the server?

Would it work like this?
Code:
call SendData("RIGHTWARP" & sep_char & x & sep_char & y & end_char)

And then on server side:
Code:
if Lcase(parse(0)) = "rightwarp" then
     Call PlayerWarp(index, GetPlayerMap(index), x, y)
end if

Would that work?

~Braydok


- Robin - 10-04-2007

Braydok Wrote:I tried, but how do you send the x and y that you got to the server?

Would it work like this?
Code:
call SendData("RIGHTWARP" & sep_char & x & sep_char & y & end_char)

And then on server side:
Code:
if Lcase(parse(0)) = "rightwarp" then
     Call PlayerWarp(index, GetPlayerMap(index), x, y)
end if

Would that work?

~Braydok

You've got the right idea, but no. The server needs to know which part of the packet the x and y are.

So,

Code:
if Lcase(parse(0)) = "rightwarp" then
     x = Parse(1)
     y = parse(2)
     Call PlayerWarp(index, GetPlayerMap(index), x, y)
end if



- Braydok - 11-04-2007

I knew that... Thanks, I'll try it. Smile

~Braydok


Edit:

Um, lol. When I right click, it warps me to like, x: 160 and y: 170 or something.

What's up?

My code:
Code:
If Player(MyIndex).Access >= 4 Then
  If button = 2 Then
    Dim Packet As String
    Packet = "RIGHTWARP" & SEP_CHAR & x & SEP_CHAR & y & END_CHAR
        Call SendData(Packet)
  End If
End If
Code:
' :::::::::::::::::::::::::::::
    ' :: Right Click Warp Packet ::
    ' :::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "rightwarp" Then
        x = Parse(1)
        y = Parse(2)
    Call PlayerWarp(Index, GetPlayerMap(Index), x, y)
    End If

Anything wrong?


- Robin - 11-04-2007

Braydok Wrote:I knew that... Thanks, I'll try it. Smile

~Braydok


Edit:

Um, lol. When I right click, it warps me to like, x: 160 and y: 170 or something.

What's up?

My code:
Code:
If Player(MyIndex).Access >= 4 Then
  If button = 2 Then
    Dim Packet As String
    Packet = "RIGHTWARP" & SEP_CHAR & x & SEP_CHAR & y & END_CHAR
        Call SendData(Packet)
  End If
End If
Code:
' :::::::::::::::::::::::::::::
    ' :: Right Click Warp Packet ::
    ' :::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "rightwarp" Then
        x = Parse(1)
        y = Parse(2)
    Call PlayerWarp(Index, GetPlayerMap(Index), x, y)
    End If

Anything wrong?

You'll need to make it so it warps you to the corresponding 32x32 tile, rather than the pixel.

I thought it was already translated in the "click" sub of the picScreen.


- Braydok - 12-04-2007

Oops, it was under key down. Tongue I think this should work.



It says that: "Variable is not defined" and highlights the "button = 2"
Huh?


- Boo - 12-04-2007

you have to define it in modTypes
Like in a Rec or something add..
Button as String

or w-e u wanna use for it >.>


- Robin - 12-04-2007

Boo Wrote:you have to define it in modTypes
Like in a Rec or something add..
Button as String

or w-e u wanna use for it >.>

No you fucking don't you fucking retard.

Don't even try to give someone else help, you utter moron.

Code:
Private Sub picScreen_MouseDown(button As Integer, shift As Integer, X As Single, Y As Single)

Put it in that, in the frmMirage code.


- Boo - 12-04-2007

thats the same fucking thing u idiot, just defining it in differnt place and as integer instead of a string but like i said change it to what u want


- Robin - 12-04-2007

Boo Wrote:thats the same fucking thing u idiot, just defining it in differnt place and as integer instead of a string but like i said change it to what u want

Having it in modTypes in a rec is doing fuck all!

You know nothing, so don't try and help someone else when they know more than you.

What I posted is the way the subroutine is handled by the windows api. Shut up.


- Boo - 12-04-2007

what you did was make it run in 1 packet but i don't see any other packet that uses Button so it wouldnt make a difference...

ANd i used rec as a place to put it so its not hard to find


- Robin - 12-04-2007

Boo Wrote:what you did was make it run in 1 packet but i don't see any other packet that uses Button so it wouldnt make a difference...

ANd i used rec as a place to put it so its not hard to find

Do you not get it?

Button, as an integer, is returned when the click on picScreen is returned.

Putting "Button" in a rec will do nothing at all.

How dare you act like you know what you are doing and think that you actually know more than me.


- Boo - 12-04-2007

go in modTypes add it anyone doesnt freaking matter

It'll work >.


- funkynut - 12-04-2007

Yep robin is completely correct. You define it in rec, its going to stay blank, you define it the way robin said, its actually going to be used, since if you notice, its an argument...