Mirage Source

Free ORPG making software.
It is currently Thu Apr 25, 2024 8:38 pm

All times are UTC




Post new topic Reply to topic  [ 284 posts ]  Go to page 1, 2, 3, 4, 5 ... 12  Next
Author Message
 Post subject: How Could I...
PostPosted: Mon Sep 15, 2008 11:32 pm 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
I'm trying to make a code that checks a player's inventory, and if they have a certain item in their inventory and they type something, then it activates. I hope that makes sense...But I don't know how to check a player's inventory and check the items they have's names.

Can anyone tell me how to do that?


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Mon Sep 15, 2008 11:34 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
make a text command that send a packet to the server. In that packet handler server side, check the person has the item in their inventory (there is already a function that does that, HasItem) and do whatever you want to do if they have it.

should be pretty easy, depending on what you want to do.

_________________
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: How Could I...
PostPosted: Mon Sep 15, 2008 11:48 pm 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Never used HasItem before...So would this work? I'm use MS4, and I have this in modHandleData

I'm still learning VB6, so please excuse my mistakes. Up till now, I've just edited other people's code to fit what I need. This is my first code that I've started from scratch...


Last edited by DarkC on Tue Sep 16, 2008 12:05 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Mon Sep 15, 2008 11:57 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
DarkC wrote:
Never used HasItem before...So would this work? I'm use MS4, and I have this in modHandleData

I'm still learning VB6, so please excuse my mistakes. Up till now, I've just edited other people's code to fit what I need. This is my first code that I've started from scratch...

Code:
        ' :::::::::::::::::
        ' :: AIDA Packet ::
        ' :::::::::::::::::
        Case CAida
        If HasItem(Index) = "AIDA" Then
            Call Aida(Index)
        Exit Sub


Look at the definition of the function, you're using it wrong.

It returns a boolean, and it takes the item number as an arguement

If HasItem(Index, ItemNum) Then
...

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 12:05 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
So then this should work, correct? Thanks for your help. And it'll check if they have the item that is number 200 right?

(this is in modGameLogic in the Client)
Code:
        ' AIDA command
        If Mid$(MyText, 1, 5) = "/aida" Then
            MyText = Mid$(MyText, 5, Len(MyText) - 4)
            Call SendData(CAida & END_CHAR)
        End If
            MyText = ""
        Exit Sub
    End If


(this is in modHandleData in the server)
Code:
        ' :::::::::::::::::
        ' :: AIDA Packet ::
        ' :::::::::::::::::
        Case CAida
        If HasItem(Index, 200) Then
            Call Aida(Index)
        Exit Sub


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 12:22 am 
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
Looks fine, should work.

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 12:55 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Alrighty...Thanks allot.

Now, when I try to compile the code. It's giving me an error on this...It was working fine before I added the AIDA code, I added the AIDA code above the CKillPlayer code, if that matters. It's highlighting "Case CKillPlayer" and giving me this error "Case Without Select Case". What do I do to fix it? It was working fine before...

Code:
        ' ::::::::::::::::::::::::
        ' :: Kill Player Packet ::
        ' ::::::::::::::::::::::::
Case CKillPlayer
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_CREATOR Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If

n = FindPlayer(Parse(1))

If n <> Index Then
If n > 0 Then
'Sends messages out
Call PlayerMsg(n, "You have been killed by an admin.", BrightRed)
Call GlobalMsg(GetPlayerName(n) & " has been killed by an admin.", BrightRed)
'Warp to starting map
Call PlayerWarp(n, START_MAP, START_X, START_Y)
Call SetPlayerPK(Index, NO)
Else
Call PlayerMsg(Index, "Player is not online.", White)
End If
Else
Call PlayerMsg(Index, "You cannot kill yourself!", White)
End If

Exit Sub


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:03 am 
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
You need an End If to close off the If statement in your AIDA packet.

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 1:19 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Thank you once again, that fixed it...But now I have a new problem when I compile it. lol

I'm getting an error in this part of my code.
Code:
Public Sub Aida()
    SetPlayerVital(Index, HP) = GetPlayerMaxVital(Index, HP) + 5000
End Sub


It's highlighting "SetPlayerVital(Index, HP) =" and saying "Argument not optional". I've never gotten that error before, so I have no clue what it means. =/


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:20 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
DarkC wrote:
Thank you once again, that fixed it...But now I have a new problem when I compile it. lol

I'm getting an error in this part of my code.
Code:
Public Sub Aida()
    SetPlayerVital(Index, HP) = GetPlayerMaxVital(Index, HP) + 5000
End Sub


It's highlighting "SetPlayerVital(Index, HP) =" and saying "Argument not optional". I've never gotten that error before, so I have no clue what it means. =/


Try putting MyIndex, instead of index.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:23 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
I put MyIndex, and it's giving me the same error.


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:39 am 
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
MyIndex is only client side

You're using the function wrong again, pay attention!

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 1:44 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
What am I doing wrong? I looked and I don't get it...How can I tell what the correct way of using it is?


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:45 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
Argument not optional - Check what you need to pass to that function


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 1:48 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Then like this? Sorry about all the trouble. :(

Code:
Public Sub Aida()
    SetPlayerVital(Index, HP, GetPlayerMaxVital) = 5000
End Sub


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:08 am 
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
You don't set functions equal to anything.

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 2:09 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Well when I don't have a = in there somewhere, it makes the text read and says it exspects a = .


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:16 am 
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
That's a nusiance of VB6.

Add "Call" before it

Or remove the outermost parentheses.

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 2:22 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Ok...I added call to it, and now it's highlighting GetPlayerMaxVital and giving the same error. :oops:


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:35 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
Then do the same thing to fix it.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:36 am 
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
GetPlayerMaxVital is a function, and it takes arguements. Check it's definition.

_________________
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: How Could I...
PostPosted: Tue Sep 16, 2008 2:44 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
But how can I have it be Called when it's in the parentheses? Because doesn't it have to be there? Because that's where the Value is supposed to be in the SetPlayerVital...


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:48 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
Functions don't need a call. You can just do

GetPlayerMaxVital(index, whatever, whatever)

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:50 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
Does your code still look like this?
Code:
Public Sub Aida()
    SetPlayerVital(Index, HP, GetPlayerMaxVital) = 5000
End Sub


If so, look at the SetPlayerVital sub.

Code:
Sub SetPlayerVital(ByVal Index As Long, ByVal Vital As Vitals, ByVal Value As Long)


Just that part is all that really matters.

You are setting it to the Index (which would be your player number), which vital do you want to set, then the value you want to set it to. Make sense?

So if you want to set your vital hp to 5000 then your code should look like this.

Code:
Public Sub Aida()
    Call SetPlayerVital(Index, Vitals.HP, 5000)
End Sub


I am not exactly sure what you are trying to do?


Top
 Profile  
 
 Post subject: Re: How Could I...
PostPosted: Tue Sep 16, 2008 2:52 am 
Offline
Regular
User avatar

Joined: Tue Jun 17, 2008 12:39 pm
Posts: 55
Never mind! Thank you, Anthony. That helped me perfectly.

Thank you all for your help.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 24 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