Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Line formatting question (SUGARCUBE 1.x)

Hello everyone. I'm working on a single player jrpg-ish turn-based combat system. I'm not particularly sure how to summarize the problem I'm having so I'll just try to be as detailed as possible:

Below is just an example of a passage that the player is linked to when he/she clicks on "cast firebolt". The <<Enemy_image>>, <<MP_regen>> and <<Actions>> are just widgets containing a whole bunch of <<if>> statements modifying various $variables. The <<Actions>> widget is particularly problematic.
<<Enemy_image>>
''<<print $enemy_name>>''
Level <<print $enemy_LVL>> <<print $enemy_type>>
Health: <<set $enemy_HP to $enemy_HP - $firebolt_PWR>><<print $enemy_HP>>/<<print $enemy_maxHP>>
Damage: <<print $enemyDMGmin>>-<<print $enemyDMGmax>>

<<set $playerMP to $playerMP - 50>>
Firebolt hits the <<print $enemy_name>> for <<print $firebolt_PWR>> damage!
<<if $enemy_HP <= 0>>You killed the <<print $enemy_name>>!<</if>>
<<MP_regen>>
<<if $enemy_HP > 0>><<Enemy_attack>><</if>>
<<if $enemy_HP > 0>><<if $playerHP > 0>>Actions:
<<Actions>><</if>><</if>>
<<if $playerHP <= 0>>Continue->Game Over<</if>>
<<if $enemy_HP <= 0>>Continue->Pre-victory<</if>>

<<audio "Firebolt" play>>


Here's my problem now: Most of the macros above as well as the widgets (especially <<Actions>>) contain TOO MANY lines of white space. Unfortunately, I can't just <<nobr>> the whole thing, because I want the output of the macros to be in a somewhat "list" order with line spacing like:

Cast Firebolt
Cast Heal
Cast Blizzard
etc
etc.

Since I'm new and do not know a better way of doing things, I simply made the above links to appear only <<if $firebolt is 1>> or <<if $heal is 1>> for example (the default at storyinit is 0... e.g. $firebolt is 0). The player plays the game and eventually gains new abilities, and I <<set>> the $firebolt variable to 1, thus making the link appear the next time battle is initiated. Unfortunately, this has the added side effect of the "invisible" Cast Firebolt taking up line spacing.

I guess the simplest way to put my question would be: Is there a way for these "non-activated" or "invisible" links to not take up white space until they are activated? Because right now the whole thing looks very messy. Any help or alternative suggestions would be greatly appreciated.

Comments

  • You could use line continuations to eliminate the line break between each <<if>> and place the line break inside the the <<if>> instead. For example:
    <<if $enemy_HP > 0>><<Enemy_attack>>
    <</if>>\
    <<if $enemy_HP > 0 and $playerHP > 0>>Actions:
    <<Actions>>
    <</if>>\
    <<if $playerHP <= 0>>[[Continue->Game Over]]
    <</if>>\
    <<if $enemy_HP <= 0>>[[Continue->Pre-victory]]
    <</if>>\
    
  • An extremely simple and effective method indeed D: Thanks very much, MadExile.
Sign In or Register to comment.