not sure what you are saying but the logic is wrong.
set total = 0 outside the loop.
currently, say you are rolling 3d6. you set total = 0 in the loop, roll a 3, total is 3. loop again. total is 0, rolled a 1, total is 1. .... that seems like not what you want.
you also spam the output. just write the total once at the end of the loop, outside of it, not in it. result printing in the loop is debug type info, do you need to see all the rolls?
goto can be beautiful, but it can also make a huge mess in a short span. Try to not do that. Let your code flow naturally to where you need to be at each point.
a loop might look like
char doneyet = 0;
do
{
play game
cout << "we done yet"
cin >> doneyet;
}while(doneyet != 'y') //example, they type y to stop, anything else is taken as a not done.
and your die goto is just silly, let me translate your code logic into words
if input is not runact
if its a spell, write a prompt for user input but don't let them type any, then go to the same line the program goes to anyway after the if statements.
else if its not a spell, go to the same line it goes to anyway.
die:
the code here is next up to run...
basically, then, if its runact you want to bypass the die block, which is doable by a simple if statement. If its not runact, you want to run the die block. you can do exactly that without any of the die gotos. the top goto is replaced by the while loop, but as you wrote it, the top goto actually does accomplish something (its a loop surrogate, which isnt a good way to use goto).
put all that together, then, and you get
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
do
...
if runact
{
runact things
}
else //isnt run-act
{
if(spell)
{anything spell specific here}
if(attack)
{anything attack specific here}
{die block} //just do this anyway, its protected from run-act by the outer else.
}
| |
does the above flow make sense to you?