11-05-2011, 04:31 AM | #21 |
GURPS FAQ Keeper
Join Date: Mar 2006
Location: Kyïv, Ukraine
|
Re: GURPS RCC (Ranged Combat Calculator)
Could you explain the problem more precisely?
|
11-05-2011, 04:52 AM | #22 |
Join Date: Jun 2011
Location: Richmond, VA
|
Re: GURPS RCC (Ranged Combat Calculator)
Here's what I am trying to do.
user inputs 45d+1 into dicebox (a textbox) which is then turned into a string the input is then plugged into a formula that will simulate rolling dice and returning a result. here is my code so far. Public Class DiceRollerApp Dim die As String = "d" Dim sdie As String Dim intlocation As Integer Dim numdice As String Dim dieopperand As String Dim diemod As String Private Sub Dicebx_TextChanged(sender As System.Object, e As System.EventArgs) Handles Dicebx.TextChanged sdie = Dicebx.Text End Sub Private Sub Rollbttn_Click(sender As System.Object, e As System.EventArgs) Handles Rollbttn.Click intlocation = InStr(sdie, "d") numdice = Microsoft.VisualBasic.Left(sdie, intlocation - 1) diemod = Microsoft.VisualBasic.Right(sdie, intlocation - 2) MessageBox.Show("this is the number of dice " & numdice) If sdie.Contains("-") = True Then MessageBox.Show("the opperand is a -") Else If sdie.Contains("+") Then MessageBox.Show("the opperand is a +") Else MessageBox.Show("no opperand") If diemod <> "d" Then MessageBox.Show("this is the die mod " & diemod) Else MsgBox("no modifier") End Sub End Class |
11-05-2011, 07:09 AM | #23 |
GURPS FAQ Keeper
Join Date: Mar 2006
Location: Kyïv, Ukraine
|
Re: GURPS RCC (Ranged Combat Calculator)
I'm not sure there's a need to bother with operands.
If you can get the string before the d, and the string after the d, then you can convert both into Int32, plug the former into a dieroller RNG, and then print the sum of the result and the second Int32 into the console or whatever. |
11-07-2011, 04:21 AM | #24 |
Join Date: Jun 2011
Location: Richmond, VA
|
Re: GURPS RCC (Ranged Combat Calculator)
Thats what I am trying to do.
Getting stuck on parsing out text from integers |
11-07-2011, 04:24 AM | #25 |
GURPS FAQ Keeper
Join Date: Mar 2006
Location: Kyïv, Ukraine
|
Re: GURPS RCC (Ranged Combat Calculator)
Didn't the examples of the three functions in the links help?
|
11-09-2011, 10:05 PM | #26 |
Join Date: Jun 2011
Location: Richmond, VA
|
Re: GURPS RCC (Ranged Combat Calculator)
Looks like I have the parsing taken care of. Now the RND is returning results that are out of range for the dice called for. So its something with my for next loop that is screwed....Arrgh
|
Tags |
gurps 4e, ranged, ranged combat |
|
|