Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm Confused o.o
#1
Ok, well I'm having a issue. I haven't edited this code at all, and it's still giving me an error. lol

I'm getting the error message that says "Argument Is Not Optional". I've tried everything I could think of, but I just can't get this one.

Code:
Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)

Tell me if you need more code that is around it.
Reply
#2
So, that's the highlighed code?

Uh...

Gimme the SendAddChar sub, please.
Reply
#3
Here is the entire thing. (I think this is what your wanted, right? o.O)

Code:
Case MENU_STATE_ADDCHAR
            frmNewChar.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending character addition data...")
                If frmNewChar.optMale.Value = True Then
                    Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
                Else
                    Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
                End If
            End If

Thanks for helping me. Big Grin
Reply
#4
If it isn't the same as what Dave just posted, I'll have to take a closer look at home.

I'm somewhat, limited, since I'm in school ATM.

But, yeah, Dave, since you know what I'm talking about, do you think it's a problem with the sub?

If it's unchanged, Daemonblade777, then I can't see an immediate problem.
Reply
#5
Actually, ya I did change that part that Dave posted. I'm trying to add Race and Alignment to my game...>.>

Code:
Sub SendAddChar(ByVal Name As String, ByVal Sex As Long, ByVal ClassNum As Long, ByVal Slot As Long, ByVal Race As Long, ByVal Alignment As Long)
Dim Packet As String

    Packet = "addchar" & SEP_CHAR & Trim(Name) & SEP_CHAR & Sex & SEP_CHAR & ClassNum & SEP_CHAR & Slot & SEP_CHAR & Race & SEP_CHAR & Alignment & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub
Reply
#6
I added the "ByVal Race As Long, ByVal Alignment As Long" part already, and it's still giving me the error...>.>
Reply
#7
Add them to where you're calling the sub...

Yeah.

If you're trying to.. Let's say, send a Byte to a sub... But you use Long, it wont work.

Ex..

Code:
Sub Hi(byval x as byte)

You can't use

Code:
Dim g as Long
Call Hi(g)

That also causes the error...
Reply
#8
Ok, well I fixed that...But now I'm getting a new error.
Code:
Case MENU_STATE_ADDCHAR
            frmNewChar.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending character addition data...")
                If frmNewChar.optMale.Value = True Then
                    Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex, frmNewChar.optBeast.ListIndex, frm.NewChar.optDark.ListIndex + 1)
                Else
                    Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
                End If
            End If
The part ".ListIndex" of the ".optBeast" part is the part I'm getting the error of "method or data member not found" on. I've never gotten this error before, so what do it even mean?
Reply
#9
I don't think Option Buttons[radio buttons] have a listindex...

Try...

Code:
Case MENU_STATE_ADDCHAR
            frmNewChar.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending character addition data...")
                If frmNewChar.optMale.Value = True Then
                         If frmNewChar.optBeast.Value = True Then
                              Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex, 1, frm.NewChar.optDark.ListIndex + 1)
                     Else
                         Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, 0, frmNewChar.optDark.ListIndex, frmChars.lstChars.ListIndex + 1)
                End If
            End If

Changes: Taking optBeast and making it affect the ByVal when called in SendAddChar, instead of trying to send something that doesn't exist.

I see frmChars.optDark.ListIndex. Either use real List Boxes, or make If Statements for every such condition. I'd recommend using List Boxes, but if you want to try an If Statement for EVERY possible combination, use Select Case instead. >.>
Reply
#10
Now it gave me an error saying that "optBeast" is not defined. o.o I used your code.
Reply
#11
frmNewChar.optBeast.Value

That's what I meant. frmNewChar. Rawr. >.>
Reply
#12
Lol, ok. Thanks for helping me. I think I got it now. ^.^
Reply
#13
No problem. =D Glad to help.

Anytime. :x
Reply
#14
Sorry it took so long to respond.

But I learned. ^.^ I had to do something like this again, and I didn't have any problems doing it.
Reply
#15
You've truly learned it when you can explain it to someone else and they can fully understand what you're talking about.

That being said, I must be a complete idiot. o.o;
Reply
#16
Aww thanks Dave. Love you too.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#17
If ignorance was bliss, then the world would be a better place than it is now. Tongue
Reply
#18
Ignorance is bliss until you have to take care of yourself.

Remember that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)