Mirage Source
I'm Confused o.o - 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: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: I'm Confused o.o (/showthread.php?tid=1514)



I'm Confused o.o - Daemonblade777 - 15-01-2008

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.


Re: I'm Confused o.o - Matt2 - 15-01-2008

So, that's the highlighed code?

Uh...

Gimme the SendAddChar sub, please.


Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

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


Re: I'm Confused o.o - Matt2 - 15-01-2008

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.


Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

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



Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

I added the "ByVal Race As Long, ByVal Alignment As Long" part already, and it's still giving me the error...>.>


Re: I'm Confused o.o - Matt2 - 15-01-2008

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


Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

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?


Re: I'm Confused o.o - Matt2 - 15-01-2008

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


Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

Now it gave me an error saying that "optBeast" is not defined. o.o I used your code.


Re: I'm Confused o.o - Matt2 - 15-01-2008

frmNewChar.optBeast.Value

That's what I meant. frmNewChar. Rawr. >.>


Re: I'm Confused o.o - Daemonblade777 - 15-01-2008

Lol, ok. Thanks for helping me. I think I got it now. ^.^


Re: I'm Confused o.o - Matt2 - 15-01-2008

No problem. =D Glad to help.

Anytime. :x


Re: I'm Confused o.o - Daemonblade777 - 21-01-2008

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.


Re: I'm Confused o.o - Kousaten - 29-01-2008

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;


Re: I'm Confused o.o - Robin - 29-01-2008

Aww thanks Dave. Love you too.


Re: I'm Confused o.o - Kousaten - 29-01-2008

If ignorance was bliss, then the world would be a better place than it is now. Tongue


Re: I'm Confused o.o - Matt2 - 30-01-2008

Ignorance is bliss until you have to take care of yourself.

Remember that.