Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with a code pls
#11
William Wrote:
pingu Wrote:William needs to learn to indent a bit better.

The only things that should be without indents is the sub declaration and the "Dim"s. After that, you start out with one indent and add another each time an "If", "For", "While", "With", or "Select" is used. you obviously remove one when you end each one.

I don't know if what you posted it your actual style or something quick you did, so ignore this post if you normally don't format like that.
Hehe, it's nice that you try to teach me. But how I program isn't really anybodies business. And sure, I havnt taken classes in how to indent. But the way I code, is the way I want, the way I think it looks easiest Smile

You haven't taken intenting classes? For shame!

Its simple. Each block of code is indented. Blocks of code go between for's if's while's and select cases, like pingu said.

You dont have a line of code right inline with the for loop if its inside the for loop, like you have
Code:
For i = 1 To MAX_PLAYERS
If IsPlaying(i) = True Then

and from there, you don't randomly and stupidly indent 2 tabs instead of 1 a la here:
Code:
For i = 1 To MAX_PLAYERS
If IsPlaying(i) = True Then
        If GetPlayerMap(Index) = GetPlayerMap(i) Then
            Armor = 0
            Helmet = 0
            Shield = 0
            Weapon = 0
        End If
    If GetPlayerArmorSlot(i) > 0 Then

This is good:
Code:
If GetPlayerArmorSlot(i) > 0 Then
        Armor = GetPlayerInvItemNum(i, GetPlayerArmorSlot(i))
    End If
    If GetPlayerHelmetSlot(i) > 0 Then
        Helmet = GetPlayerInvItemNum(i, GetPlayerHelmetSlot(i))
    End If
    If GetPlayerShieldSlot(i) > 0 Then
        Shield = GetPlayerInvItemNum(i, GetPlayerShieldSlot(i))
    End If
    If GetPlayerWeaponSlot(i) > 0 Then
        Weapon = GetPlayerInvItemNum(i, GetPlayerWeaponSlot(i))
    End If

Este es muy mal!
Code:
Packet = "itemworn" & SEP_CHAR & i & SEP_CHAR & Armor & SEP_CHAR & Weapon & SEP_CHAR & Helmet & SEP_CHAR & Shield & SEP_CHAR & END_CHAR
Call SendDataTo(Index, Packet)
End If
Next i
the packet part should be intented 1 tab to the right of the End If
the end if should be indented 1 tab to the right of the Next
and the next would be better indented one tab to the right of end sub.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)