Advice and questions about undum

I am currently in the process of building a game in undum, and the number of times I hit a problem are starting to build up. Also html AND javascript are new to me and I am learning both to do this project. (Yes I am bashing my head against code and it may sound like I am over my head but I have already broken through the wall of javascript and html to the point I have a functioning barebones skeleton of an exploreable world and intro.)

I have looked over Raconteur and vorple but they both seem to complicate things in ways I am not understanding. And I fear they may limit what I am trying to build. (probably not vorple but still)

I have two questions that are currently pressing that I haven’t been able to solve right now…

  1. How do I create health bars or energy meters and things like that? (I am willing to guess it involves that css thing)

  2. Is there an easy way to activate a function from a diffrent situation within html WITHOUT swapping situations? (I already discovered how to call external functions without swapping situations using javascript) I basicly need global functions that only activate when a href linky thing is clicked in the character panel.

  1. Yes it involves progress bars. Undum already has all the CSS for these, but I guess you need to show a bar in a quality block, for a quality.

Look at QualityDefinition docs. You can write the title parameter like this (see #ui_library block in HTML):

<div class="progress_bar">
  <span class="name" data-attr="name">Quality Name</span>
  <span class="value" data-attr="value">24</span>
  <div class="progress_bar_track">
    <div class="progress_bar_color" data-attr="width" style="width:24%">
  <span class="left_label" data-attr="left_label">Left Label</span>
  <span class="right_label" data-attr="right_label">Right Label</span>

There are other ways to do that but this is most Undum-like. And yes, this is 100% real web development.

  1. No, there is no HTML API for that.

Thankyou SOOO much for that progress bar thing! that will really improve what I am planning.

As I learn more and more javascript things are starting to make more sense. Situations actually being some sort of prototype thingy… and how the code cleans up links…

I already have built an extra function that cleans up previous links after switching ACTIONS. That way I can more cleanly progress the story without swaping situations as often. Thus saving the special headings for scene swaps. Also added in a name prompt that works even though loading a saved game.

I even have created a new sort of choice offer system.

The more I code this the LESS like vanilla undum it looks. At this rate I am actually building a game engine over the top of undum rather than a simple undum story.

I do have ONE question currently though… Why are the sandbox objects used to store data when it seems global objects and variables would do the same thing? Err… let me be more specific. I can either character.sandbox.door3locked=false OR door3locked=false. Is there a reason the sandbox is superior to this way? (I realize the scope idea and that it lets other parts of the window see the carried over objects when called *I think, but other than the character panel what other parts would care about the sandbox objects?)

Saving and loading. Undum doesn’t save any visited actions but saves sandbox objects by default.

Well… that certainly would do it. I can that that into consideration while coding as well.

Now if only I could get that progress bar thing to work. So far I haven’t been able to use the qualitydefenition function successfully. I would really like to be able to put a dollar sign after money amounts or convert values to progress bars. The second poster helped a ton and pointed me in the right direction but it seems I need to learn more javascript/html before I can manage it.


So this is one that learning tons of javascript just wont solve.

My code has begun to get massive and things are getting harder and harder to find. I do my best to keep it “object oriented” I believe is the term for it.

But that also makes jumping down to build a new global function and then searching for where I WAS to use the function a painful experience.

SO to all the IF fiction writers out there… What methods do you use to keep track of where in the code you are working? Any good specific javascript editing programs that make IF writing easier? (currently using html kit and some firefoxy thing called firebug I think.) Or maybe just handy tips for keeping IF code tidy?

I haven’t done any work in Undum or Javascript, but I make heavy use of section headers in Inform (see the source code for Five Gods Exiled for an example), and I try to comment my code helpfully in C and C#.

Can you split your work into multiple files? I haven’t worked in Javascript or Undum, but that’s the main way I keep track of different systems in C# (along with code comments). Inform 7 doesn’t support multiple files under normal circumstances, but I make heavy use of section headers and jump around with the IDE, and I have a separate extension (like an imported library) for things I find myself putting in every single game.

As for remembering where I’m working: if I leave off in a particular spot between sessions, I usually leave a comment like this: “***CAROLYN CONTINUE HERE” and then I search for *** when I start my next session. Or, if I feel strongly enough about Definitely Starting There, I leave it uncommented to break the code so I can’t continue anywhere else.

I work in my OO-oriented fork called Salet; the Gulpfile is constructed to allow splitting the game into smaller chunks however I need; you can construct such thing (gulp + gulp-concat) for a regular Undum project. No other tips, sorry.