I am trying to find a way to maka my Role Playing XP Tracker program easier to use. I have 1 NSTextField where they type in the numbers and another where you add a character.
So the GM would say "You took a 12B Damage". 12 being the hit points and B being the critical which in this example would be equal to 20 for a total of 22 hit points.
I currently convert the 12 in the NSTextField to in INT. Then take the 'B' and pass it as an argument in method with a bunch of IF statements (like a switch) and then B returns the INT 20. Add them together and get 22.
The people I play with said they would rather type '12B' into one NSTextField to make it faster. I know I could use code like this to extract each one.
What would be a good way to convert it? char '1' and '2' would need to be int 12 and not int 1 and 2?
Any ideas on how to process?
So the GM would say "You took a 12B Damage". 12 being the hit points and B being the critical which in this example would be equal to 20 for a total of 22 hit points.
I currently convert the 12 in the NSTextField to in INT. Then take the 'B' and pass it as an argument in method with a bunch of IF statements (like a switch) and then B returns the INT 20. Add them together and get 22.
The people I play with said they would rather type '12B' into one NSTextField to make it faster. I know I could use code like this to extract each one.
Code:
for(int i =0 ;i<[myString length]; i++) {
char = [myString characterAtIndex:i];
}
What would be a good way to convert it? char '1' and '2' would need to be int 12 and not int 1 and 2?
Any ideas on how to process?