Variable scope within Conditional statement

Goodaye,

Playing around with this. Love it.

I've noticed that when you create an inline variable or assign a value to a previously defined variable within a conditional statement then the scope of the variable seems to be limited to within the conditional statement.

eg.
set: mod_str = 0
...
[when] {$diff_level} = Easy [do] [mod_str==250] [end]
...
Modified strength = {$mod_str}

or

set: mod_str = 0
...
[when] {$diff_level} = Easy [do] {!mod_str==250+2} [end]
...
Modified strength = {$mod_str}

or

set: mod_str = 0
...
[when] {$diff_level} = Easy [do] [@mod_str==some_table] [end]
...
Modified strength = {$mod_str}

All give an output of
Modified strength = 0

instead of what has been assigned to the variable within the conditional statement.

Anyway around this?


Oh, and I noticed that when you use InspirationPad from within The Keep that the prompts don't work. Once again, anyway around this?

Cheers,
Plugger

Comments

  • Goodaye,

    O.K, I figured it out. Turns out that I was getting muddled up with the programming paradigm. I was thinking lines of code in a program executing sequentially as opposed to each line being a possible selection in a table. Got it sorted now.

    I'd still be interested in why Inspiration Pad programs with Prompt statements don't fire up in The Keep. Is it a command line implementation?

    Cheers,
    Plugger
  • Not sure - they should work in the Keep. My generators w/ prompts show ok. Is this a home made generator or one of the included ones?
  • Goodaye,

    Mmmm. Checked again and it's now working as designed. This was a home made *.ipt and I'm still climbing the learning curve so perhaps it was something that I had or hadn't done in the program.

    Anyway, thanks for the reply. I'm finding both programs very useful.

    Cheers,
    Plugger

Leave a Comment