locked
Having trouble with maths functions - please help. RRS feed

  • Question

  • Hi I need to do a card game programme.

    I have to make the programme work out a strength attribute.

    The way I do this is Strength is already at 10.

    I roll a 12 sided dice and 4 sided dice and divide the '12' dice number by the '4' dice number. This number is then added onto the 10 and a strength attribute is made like this.

    Can someone please help me do this?

    I have copied and pasted the relevant parts. It is the bottom I am stuck on. Please help.

    S1 = 10.

    If i = 4 Then

    Result1 = Math.GetRandomNumber(4)

    TextWindow.WriteLine("You rolled a " + i + " sided dice and got " + Result1 + ".")

    'I'm using "if" statements for this part of the success criteria. I'm also using the Math function of getting random numbers.

    Else

    TextWindow.WriteLine("ERROR ERROR. Does not compute. You chose not to roll a 4 sided dice so the program did not work!")

    EndIf

    TextWindow.Writeline("This time roll a 12 sided dice for the total value of STRENGTH " + char1 + " will have.")

    b = TextWindow.Read()

    If b = 12 then

    Result2 = Math.GetRandomNumber(12)

    TextWindow.WriteLine("You rolled a " + b + " sided dice and got " + Result2 + ".")

    Else

    TextWindow.WriteLine("ERROR ERROR. Does not compute. You chose not to roll a 12 sided dice so the program did not work!")

    EndIf

    Math

    .Round(Result2/Result1+S1 = CS1)Array.ContainsValue

    CS1 = TextWindow.Read()

    Textwindow.WriteLine("You got " + CS1 + " STRENGTH for " + char1 + ".")

    Tuesday, March 12, 2013 10:06 PM

Answers

  • Not sure if its a formatting problem with your post, but

    Math.Round(Result2/Result1+S1 = CS1)Array.ContainsValue

    looks wrong

    Perhaps you want:

    strength = Math.Round(S1+Result2/Result1)

    TextWindow.WriteLine("You got "+strength+" STRENGTH for"+char1+".")

    Tuesday, March 12, 2013 10:29 PM