Mirage Source

Free ORPG making software.
It is currently Sat Apr 20, 2024 12:26 am

All times are UTC




Post new topic Reply to topic  [ 78 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: frmWarp
PostPosted: Tue Jan 15, 2008 1:06 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
ok i decided to make a new frm called frmwarp....it comes out when i press the F6 button...
this is the code i used
Code:
Private Sub cancelcmd_Click()
Unload Me
End Sub

Private Sub Form_Load()

End Sub

Private Sub warpcmd_Click()
If selectwarp.Text = "Castle" Then Call AddText("Cannot warp at the moment", BrightRed)
End Sub

this way when i select Castle in the combo box and then i press the warp button the frm call the AddText Cannot warp atm.....how to make the player warp??what is the code??
thx :D


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 1:26 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
First, you need to use proper nesting.

The If Statement you've written isn't... So to speak, well enough to handle what you want.

Code:
If <Condition> Then
    <Effect 1>
    <Effect 2>
Else
    <Effect 3>
    <Effect 4?
End if


So, if you set it up like that, I believe the warping code[client side] is...

Code:
Call PlayerWarp(MyIndex, MapNum, X, Y)


I'm in class, so, I can't check.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 3:16 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
uhm...don't understand sorry :(
Quote:
Private Sub Command1_Click()
If Castle Then Call PlayerWarp(MyIndex, 2, 2, 2)
Else: Call AddText("Cannot warp at the moment", BrightRed)
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

where do i have to put the conditions??


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 5:23 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Castle IS the condition.

Code:
If x = 1 Then


X = 1 is the CONDITION. So... Now that you know that, your condition is when the radio button's caption is "Castle" right?

Code:
Private Sub Command1_Click()
    If selectwarp.Text = "Castle" Then
        Call PlayerWarp(MyIndex, 2, 2, 2)
    Else
        Call AddText("Cannot warp at the moment", BrightRed)
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub


Note how I nested it for you.
That's how it should look like.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 6:39 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
srry but it doesnt work for me :(
this is the code
Code:
Private Sub cancelcmd_Click()
Unload Me
End Sub

Private Sub warpcmd_Click()
 If selectwarp.Text = "Castle" Then
        Call PlayerWarp(MyIndex, 2, 2, 2)
    Else
        Call AddText("Cannot warp at the moment", BrightRed)
    End If
End Sub

it gives me an error and says that Call PlayerWarp is wrong.....
Then i tried with other functions:
Code:
Private Sub cancelcmd_Click()
Unload Me
End Sub

Private Sub warpcmd_Click()
 If selectwarp.Text = "Castle" Then
        Call WarpTo(2)
    Else
        Call AddText("Cannot warp at the moment", BrightRed)
    End If
End Sub

this way it works but i can only decide the map,its not working for X and Y


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 10:31 pm 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
Actually you can do:
Code:
If statement then code

No end if needed, but it doesn't support elseif

Code:
If x > 0 then call add(x)

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Tue Jan 15, 2008 10:32 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Here's an easy fix.

In the client, go to the code.

Search for where it says...

Code:
Sub WarpTo(ByVal MapNum As Long)
Dim Packet As String
   
    Packet = "WARPTO" & SEP_CHAR & MapNum & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub


Add this one

Code:
Sub WarpTo2(ByVal MapNum As Long, x As Long, y As Long)
Dim Packet As String
   
    Packet = "WARPTO2" & SEP_CHAR & MapNum & SEP_CHAR & x & SEP_CHAR & y & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub


Now, you're done with the client.

Go to the server. Search for this code in the server.

Code:
' ::::::::::::::::::::::::
    ' :: Warp to map packet ::
    ' ::::::::::::::::::::::::
    If LCase(Parse(0)) = "warpto" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_MAPPER Then
            Call HackingAttempt(Index, "Admin Cloning")
            Exit Sub
        End If
       
        ' The map
        n = Val(Parse(1))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MAPS Then
            Call HackingAttempt(Index, "Invalid map")
            Exit Sub
        End If
       
        Call PlayerWarp(Index, n, GetPlayerX(Index), GetPlayerY(Index))
        Call PlayerMsg(Index, "You have been warped to map #" & n, BrightBlue)
        Call AddLog(GetPlayerName(Index) & " warped to map #" & n & ".", ADMIN_LOG)
        Exit Sub
    End If


And add this one
Code:
' :::::::::::::::::::::::::::::::::
    ' :: Warp(map,x,y) to map packet ::
    ' :::::::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "warpto2" Then
        ' Prevent hacking[commented]
        'just in case you want this to be a admin only
        'feature if you want it to be an admin only feature
        'uncomment the commented code below
        '/////////////////////////////////////////////////
        'If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        '    Call HackingAttempt(Index, "Admin Cloning")
        '    Exit Sub
        'End If
        '/////////////end admin only code/////////////////
       
        ' The map
        n = Val(Parse(1))
       
        'x and y
        x = Val(Parse(2))
        y = Val(Parse(3))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MAPS Then
            Call HackingAttempt(Index, "Invalid map")
            Exit Sub
        End If
       
        'prevent out of range[hacking]
        If x > MAX_MAPX Or y > MAX_MAPY Or x < 0 Or y < 0 Then
            Call HackingAttempt(Index, "Warping out of range")
            Exit Sub
        End If
       
        Call PlayerWarp(Index, n, x, y)
        Call PlayerMsg(Index, "You have been warped to map #" & n & "(" & x & "," & y & ")", BrightBlue)
        Call AddLog(GetPlayerName(Index) & " warped to map #" & n & "(" & x & "," & y & ")", ADMIN_LOG)
        Exit Sub
    End If


And there you have it. It should work. Now all you have to do Client side is call WarpTo2(mapnum,x,y).

Basically, this...

Code:
Private Sub cancelcmd_Click()
Unload Me
End Sub

Private Sub warpcmd_Click()
If selectwarp.Text = "Castle" Then
        Call WarpTo2(2, 2, 2)
    Else
        Call AddText("Cannot warp at the moment", BrightRed)
    End If
End Sub


@Stomach: I know that, but I told him if he wants to be somewhat proper with it, and allow for more complex if statements, nesting and using End If is essential.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 4:48 pm 
Offline
Regular

Joined: Mon May 29, 2006 6:04 pm
Posts: 66
he could also use
Code:
Select Case SelectWarp.Text
Case "Castle"
    Call WarpTo2(m,x,y)
Case Else
    Call AddText("no such destination", BrightRed)
End Select

just an idea..


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 5:35 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
A case would be easier for multiple destinations.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 6:38 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
Quote:
::::::::::::::::::::::::
' :: Warp to map packet ::
' ::::::::::::::::::::::::
If LCase(Parse(0)) = "warpto" Then
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_MAPPER Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If

' The map
n = Val(Parse(1))

' Prevent hacking
If n < 0 Or n > MAX_MAPS Then
Call HackingAttempt(Index, "Invalid map")
Exit Sub
End If

Call PlayerWarp(Index, n, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & n, BrightBlue)
Call AddLog(GetPlayerName(Index) & " warped to map #" & n & ".", ADMIN_LOG)
Exit Sub
End If

ehm....i dont have this code in the server...thx anyway


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 6:39 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
i only have this
Code:
Case "warpto"
        Call PlayerWarp(index, Val(Parse(1)), GetPlayerX(index), GetPlayerY(index))
        Exit Sub


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 6:40 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
You do...

I pulled it from a blank 3.03...

Maybe it might be different... If you're using MSE.

Ugh, I hate MSE. >.>

[Edit]

... Wow. That's. Gay. xD

Okay just... Throw that in. Don't use If, use a Case.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 6:52 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
so i have simply to put your code
Code:
' :::::::::::::::::::::::::::::::::
    ' :: Warp(map,x,y) to map packet ::
    ' :::::::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "warpto2" Then
        ' Prevent hacking[commented]
        'just in case you want this to be a admin only
        'feature if you want it to be an admin only feature
        'uncomment the commented code below
        '/////////////////////////////////////////////////
        'If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        '    Call HackingAttempt(Index, "Admin Cloning")
        '    Exit Sub
        'End If
        '/////////////end admin only code/////////////////
       
        ' The map
        n = Val(Parse(1))
       
        'x and y
        x = Val(Parse(2))
        y = Val(Parse(3))
       
        ' Prevent hacking
        If n < 0 Or n > MAX_MAPS Then
            Call HackingAttempt(Index, "Invalid map")
            Exit Sub
        End If
       
        'prevent out of range[hacking]
        If x > MAX_MAPX Or y > MAX_MAPY Or x < 0 Or y < 0 Then
            Call HackingAttempt(Index, "Warping out of range")
            Exit Sub
        End If
       
        Call PlayerWarp(Index, n, x, y)
        Call PlayerMsg(Index, "You have been warped to map #" & n & "(" & x & "," & y & ")", BrightBlue)
        Call AddLog(GetPlayerName(Index) & " warped to map #" & n & "(" & x & "," & y & ")", ADMIN_LOG)
        Exit Sub
    End If
in the server under
Code:
Case "warpto"
        Call PlayerWarp(index, Val(Parse(1)), GetPlayerX(index), GetPlayerY(index))
        Exit Sub

and then in the client
Code:
Select Case SelectWarp.Text
Case "Castle"
    Call WarpTo2(m,x,y)
Case Else
    Call AddText("no such destination", BrightRed)
End Select

right??


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 8:16 pm 
Offline
Regular

Joined: Mon May 29, 2006 6:04 pm
Posts: 66
not exactly
you must change this
Code:
  If LCase(Parse(0)) = "warpto2" Then

to this
Code:
  Case "warpto2"

and remove the last
end if


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 8:31 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
I get this error: Sub or function not defined


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 8:42 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
So which sub or function is undefined? Define it.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 8:46 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
this is the error


Attachments:
error.jpg
error.jpg [ 38.13 KiB | Viewed 13705 times ]
Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 8:50 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Then you never defined the sub. Matt wrote it above, but your arguements are different than his anyways (his does not have an index) so maybe check with him to see if it needs it or not.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 9:00 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
it doesnt work also without the index.....the problem is the "Call warpto2"


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 9:16 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
obviously, it doesn't work with the index, either :P

You need to define the function, and modify Matt's to work with the index value.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 9:24 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
little help??? :D


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 9:27 pm 
Offline
Regular

Joined: Mon May 29, 2006 6:04 pm
Posts: 66
Matt wrote:
Here's an easy fix.

In the client, go to the code.

Search for where it says...

Code:
Sub WarpTo(ByVal MapNum As Long)
Dim Packet As String
   
    Packet = "WARPTO" & SEP_CHAR & MapNum & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub


Add this one

Code:
Sub WarpTo2(ByVal MapNum As Long, x As Long, y As Long)
Dim Packet As String
   
    Packet = "WARPTO2" & SEP_CHAR & MapNum & SEP_CHAR & x & SEP_CHAR & y & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub


that bit you still need to do


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 9:59 pm 
Offline
Newbie

Joined: Mon Jun 18, 2007 9:53 am
Posts: 24
thaaaaaaaaaaanks!!!!!!! :D :D :D :D :D :D :D :D :D :D :D
now it works!!!!
:mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 11:14 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
I only had to hint at it a few times ;-;

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: frmWarp
PostPosted: Wed Jan 16, 2008 11:17 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Lol, the newbs.

You can totally change it if you want. I dun care, It took me no longer than 5 minutes. :P

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 78 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group