Mirage Source
http://web.miragesource.net/forums/

Right-click warping
http://web.miragesource.net/forums/viewtopic.php?f=210&t=1578
Page 1 of 3

Author:  Braydok [ Tue Mar 27, 2007 10:34 pm ]
Post subject:  Right-click warping

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

Author:  Robin [ Wed Mar 28, 2007 9:00 am ]
Post subject: 

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

Author:  Braydok [ Wed Mar 28, 2007 10:58 am ]
Post subject: 

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

Author:  Robin [ Wed Mar 28, 2007 1:38 pm ]
Post subject: 

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

Author:  Tony [ Wed Mar 28, 2007 1:52 pm ]
Post subject: 

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

Author:  Braydok [ Fri Mar 30, 2007 3:58 pm ]
Post subject: 

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

Author:  Robin [ Fri Mar 30, 2007 4:30 pm ]
Post subject: 

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 ^^

Author:  Boo [ Fri Mar 30, 2007 8:26 pm ]
Post subject: 

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

Author:  Robin [ Fri Mar 30, 2007 8:28 pm ]
Post subject: 

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.

Author:  Boo [ Fri Mar 30, 2007 8:33 pm ]
Post subject: 

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

Author:  Braydok [ Tue Apr 10, 2007 11:16 am ]
Post subject: 

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

Author:  Robin [ Tue Apr 10, 2007 11:35 am ]
Post subject: 

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.

Author:  Braydok [ Tue Apr 10, 2007 10:48 pm ]
Post subject: 

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

Author:  Robin [ Tue Apr 10, 2007 10:59 pm ]
Post subject: 

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

Author:  Braydok [ Wed Apr 11, 2007 12:14 pm ]
Post subject: 

I knew that... Thanks, I'll try it. :)

~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?

Author:  Robin [ Wed Apr 11, 2007 4:48 pm ]
Post subject: 

Braydok wrote:
I knew that... Thanks, I'll try it. :)

~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.

Author:  Braydok [ Thu Apr 12, 2007 11:11 am ]
Post subject: 

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



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

Author:  Boo [ Thu Apr 12, 2007 11:00 pm ]
Post subject: 

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 >.>

Author:  Robin [ Thu Apr 12, 2007 11:06 pm ]
Post subject: 

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.

Author:  Boo [ Thu Apr 12, 2007 11:10 pm ]
Post subject: 

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

Author:  Robin [ Thu Apr 12, 2007 11:13 pm ]
Post subject: 

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.

Author:  Boo [ Thu Apr 12, 2007 11:16 pm ]
Post subject: 

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

Author:  Robin [ Thu Apr 12, 2007 11:19 pm ]
Post subject: 

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.

Author:  Boo [ Thu Apr 12, 2007 11:19 pm ]
Post subject: 

go in modTypes add it anyone doesnt freaking matter

It'll work >.<!

Author:  funkynut [ Thu Apr 12, 2007 11:22 pm ]
Post subject: 

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...

Page 1 of 3 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/