Thank you zeddy for the international selections. Sorry for not responding sooner as I just got back from my vacation and what a treat I came back to! It might actually be easier if you wrote a short bit of pseudo-code describing what it is you’re trying to do ?
#MONOPOLY PC BOARD GAME CODE#
That doesn’t look like VBA to me – it just looks like a chunk of VB code that’s been pasted into Excel and therefore won’t ever work! It seems that most descriptions of the graphics is stationary dice with flipping faces that eventually stop at some combination of numbersĭoes Excel actually run that code or does it fail when you try to compile it? Public Function Field(ByVal sourceString As String, ByVal delimiter As Char, ByVal pos As Integer) As Stringĭim parts() As String = sourceString.Split(delimiter) ' Using the delimiter to split the string into chunks, return the pos chunk Total = total + CInt(objRandom.Next(numberOfSidesPerDice) + 1) ' Set up a random object randomised by the syystem date and timeĭim objRandom As New System.Random(CType( Mod, Integer)) If Integer.TryParse(value, 0) = True Then ' Ah so there is no d so we assume it's not a forumlar, just a number If Integer.TryParse(bit, modifier) = False Then ' now we take the right side of the +/- and set that to the modifier If Integer.TryParse(bit, numberOfSidesPerDice) = False Then ' there is a + or a - so we need to extract the number on the leftĭim bit As String = Field(tmp, CChar(modType), 1).Trim
If Integer.TryParse(tmp, numberOfSidesPerDice) = False Then ' and we take the right side of the d as the number of sides ' if does not contain a + or a -, then there is no modifer If Integer.TryParse(tmp, numberOfDice) = False Then ' and convert it to an integer if it's a number, errors are silently ' There is so first we need to get the value infront of the d ' First we check to see if there is a "d" in the string ' setup working variables to make things easier
Public Function RollDice(value As String) As Integer If anyone is up for the challenge, you will have at least one captive audience and a salute when I drink down my next beer. Is there an equivalent in VBA? Most of what I am reading refers to Visual Basic and gives me error messages when I attempt to run it from Excel. Back in the day this was easy to do on my Texas Instrument TIAA “something or other” using extended basic and sprites. I prefer to do this directly on the sheet as opposed to a user form which was the only solution I found. I want to show an animation of a dice rolling across the board when the user clicks a “ROLL DICE” button. I don’t think I will have a problem with that but that will be my next hurdle. The board logic seems that it will be mostly be “IF” statements and message boxes for the cards and statistics. Using Randomize and the Rnd function that I picked off from the help menu, I can randomly generate numbers that will pick a card (by the row number) and roll the dice. I have been learning VBA slowly by scouring the Internet and picking up tid bits in this forum. I have a data sheet that has all the data for the streets and an Info sheet the has the data for the Chance and Community Chest cards. Aligning columns and rows while using the color scheme, amazingly it resembles the game board fairly well.
It will also be entertaining when completed. It is certainly not Pulitzer prize material but is a challenge to myself if I can do it. I have been messing around in my leisure time designing a Monopoly game to be played on an excel spread sheet.