Mirage Source
Code Error - 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: Code Error (/showthread.php?tid=2515)



Code Error - timster0 - 21-01-2009

I'm getting "Case without Select Case" (the bolded case is what its highlighting)

Code:
' Check to see if its any sort of ArmorSlot/WeaponSlot
                Select Case Item(GetPlayerInvItemNum(index, InvNum)).Type
                    Case ITEM_TYPE_ARMOR
                        If InvNum = GetPlayerEquipmentSlot(index, Armor) Then
                            Call SetPlayerEquipmentSlot(index, 0, Armor)
                            Call SendWornEquipment(index)
                        End If
                        MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                    
                    Case ITEM_TYPE_WEAPON
                        If Item(GetPlayerInvItemNum(index, InvNum)).TwoHanded < 1 Then
                          If InvNum = GetPlayerEquipmentSlot(index, Weapon) Then
                                Call SetPlayerEquipmentSlot(index, 0, Weapon)
                                Call SendWornEquipment(index)
                          End If
                                MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                        If InvNum = GetPlayerEquipmentSlot(index, Weapon) Then
                            Call SetPlayerEquipmentSlot(index, 0, Weapon)
                            Call SendWornEquipment(index)
                        End If
                        MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                        
                    [b]Case[/b] ITEM_TYPE_HELMET
                        If InvNum = GetPlayerEquipmentSlot(index, Helmet) Then
                            Call SetPlayerEquipmentSlot(index, 0, Helmet)
                            Call SendWornEquipment(index)
                        End If
                        MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                                        
                    Case ITEM_TYPE_SHIELD
                        If InvNum = GetPlayerEquipmentSlot(index, Shield) Then
                            Call SetPlayerEquipmentSlot(index, 0, Shield)
                            Call SendWornEquipment(index)
                        End If
                        MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                End Select

Any fix?


Re: Code Error - Nean - 22-01-2009

You have too many

Code:
End If
's


Re: Code Error - Anthony - 22-01-2009

No, he is missing an End if.

Code:
Case ITEM_TYPE_WEAPON
                        If Item(GetPlayerInvItemNum(index, InvNum)).TwoHanded < 1 Then
                          If InvNum = GetPlayerEquipmentSlot(index, Weapon) Then
                                Call SetPlayerEquipmentSlot(index, 0, Weapon)
                                Call SendWornEquipment(index)
                          End If
                                MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)
                        If InvNum = GetPlayerEquipmentSlot(index, Weapon) Then
                            Call SetPlayerEquipmentSlot(index, 0, Weapon)
                            Call SendWornEquipment(index)
                        End If
                        MapItem(GetPlayerMap(index), i).Dur = GetPlayerInvItemDur(index, InvNum)



Re: Code Error - timster0 - 22-01-2009

Works now, thanks.