06-09-2003, 08:02 PM
Hi.
- I got two SUB's, one that writes out a message in the shape of a string called text$ (SUB PrintMsg) and one that creates this string (SUB MsgWriting).
- The string can be as long as 8 x 50 characters, defending on how many enemies that hits you at the same time ( from 1 to 8 enemies can strike the player at the same time).
- I wan't the program to display each enemy-attack per line (one line of information, then PressAnyKey and then the next enemy-attack and so on).
- Right now, I've tried to make it so each enemy-attack-text-message get's 50 character (the engine adds spaces until the message reached 50 character)
Code below: Both SUB's have been cuted, but they display what's needed. And yes, mmonattacktext$ = text$
- I got two SUB's, one that writes out a message in the shape of a string called text$ (SUB PrintMsg) and one that creates this string (SUB MsgWriting).
- The string can be as long as 8 x 50 characters, defending on how many enemies that hits you at the same time ( from 1 to 8 enemies can strike the player at the same time).
- I wan't the program to display each enemy-attack per line (one line of information, then PressAnyKey and then the next enemy-attack and so on).
- Right now, I've tried to make it so each enemy-attack-text-message get's 50 character (the engine adds spaces until the message reached 50 character)
Code below: Both SUB's have been cuted, but they display what's needed. And yes, mmonattacktext$ = text$
Code:
SUB printmsg (text$)
LOCATE 1, 1: PRINT SPACE$(79)
IF LEN(text$) < 79 THEN
LOCATE 1, 1: PRINT text$
ELSE
textstart = 1
textlenght = 50
FOR x = 1 TO LEN(text$) / 50
showtext$ = MID$(text$, textstart, 50)
LOCATE 1, 1: PRINT showtext$ + " -more-": pak: LOCATE 1, 1: PRINT SPACE$(79)
textstart = textstart + 50
NEXT x
END IF
END SUB
SUB MsgWriting ()
FOR monnumatt = 1 to numenemies
a$ = RTRIM$(Monster(MonNum).MName)
damage = Rand(MAttacks(MonAttNum).AttackDice, MAttacks(MonAttNum).AttackDice * MAttacks(MonAttNum).AttackSides)
monattacktext$ = a$ + " " + RTRIM$(MAttacks(MonAttNum).AttackDesc) + " you for " + LTRIM$(STR$(damage)) + " damage! "
mmonattacktext$ = mmonattacktext$ + monattacktext$ + SPACE$(50 - LEN(monattacktext$))
Player.ptemphitpoints = Player.ptemphitpoints - damage
ELSE
a$ = RTRIM$(Monster(MonNum).MName)
monattacktext$ = a$ + " misses You! "
mmonattacktext$ = mmonattacktext$ + monattacktext$ + SPACE$(50 - LEN(monattacktext$))
END IF
NEXT monnumatt
END IF
END SUB