Even though in the title I put question about item types, this really could be applied to everything, tile attributes, etc.
So I was writing the first little bit of my fishing system into a vanilla MS4 engine, and here is my case Item_Type_Pole
SPOILER: (click to show)
Code:
Case ITEM_TYPE_POLE
Randomize Timer
Dice1 = (Int((100 - 1 + 1) * Rnd + 1))
Slevel = Int(GetPlayerStat(Index, Stats.Defense))
chance = (Int(((Slevel) * 100) / (32000)))
If Dice1 <= chance Then
i = 1
Do While i <= 24
i = i + 1
Loop
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_WATERSIDE Then
Call PlayerMsg(Index, "You have succeeded.", Yellow)
Else
Call PlayerMsg(Index, "You are not near the water.", Red)
End If
Else
Call PlayerMsg(Index, "Failure.", Red)
End If
Now my question is, would it be faster to leave this code here, or move it into its own sub, and call it when Item_Type_Pole is used?
Right now I don't see it making TOO big of a difference, but it may make a difference when I have 1/2 of my fishing code hard coded into a single case for an Item Type.