Assigning stats at the start of a game, Can I streamline/do this more elegnatly

I'm working on a fairly simple system to let the player assign stats at the start of the game, I can get it to work with minimal problems but the player keeps having to retrigger the command to assign points, I'd like for them to just be able to keep clicking on the link to add till they run out of points, I suppose I could just endlessly next options in the script but that seems very inefficient and likely to cause more bugs.

Maybe something like repeat script till fails(Ie unspent points go to 0)
Thank you.

Attributes = NewStringList()
list add (Attributes, "Fight")
list add (Attributes, "Charm")
list add (Attributes, "Trickery")
list add (Attributes, "Escape")
if (player.Unspentpoints = 0) {
  msg ("You have no more points to distribute")
}
else {
  ShowMenu ("You can now add your points to your stats", Attributes, true) {
    if (result = "Fight") {
      player.Fight = player.Fight+ 1
      player.Unspentpoints = player.Unspentpoints-1
      msg ("Your fight is now {player.Fight}")
    }
    else if (result = "Escape") {
      player.Escape = player.Escape+ 1
      player.Unspentpoints = player.Unspentpoints-1
      msg ("Your escape is now {player.Escape}")
    }
    else if (result = "Trickery") {
      player.Trickery = player.Trickery+ 1
      player.Unspentpoints = player.Unspentpoints-1
      msg ("Your trickery is now {player.Trickery}")
    }
    else if (result = "Charm") {
      player.Charm = player.Charm + 1
      player.Unspentpoints = player.Unspentpoints-1
      msg ("")
      msg ("Your charm is now {player.Charm}")
    }
  }
  msg ("You have {player.Unspentpoints} Points left to spend")
}

I'd probably make it something more like:

if (player.Unspentpoints = 0) {
  msg ("You have no more points to distribute")
}
else {
  ShowMenu ("You can now add your points to your stats", Split("Fight;Escape;Charm;Trickery"), true) {
    statvalue = GetInt (player, result)
    statvalue = statvalue + 1
    set (player, result, statvalue)
    player.Unspentpoints = player.Unspentpoints - 1
    msg ("Your "+result+" is now "+statvalue)
  }
}

Do you want something like I did for the control panel here?
http://textadventures.co.uk/games/view/z80i597m50wk__83uezg_q/wumpus-2-0
You could also have something like this:
Fight [-] [+]
Charm [-] [+]
Trickery [-] [+]
Escape [-] [+]
The [-] and [+] are command buttons that subtract or add a point until the player runs out.
and have a [continue] command to move the player to the next room to start the adventure...


here's a thread/post on it (has the source code: Jaynabonne's 'levellib' code):

https://textadventures.co.uk/forum/quest/topic/5089/solved-level-library-pixies

here's also a newer thread by a user needing help on it too:

http://textadventures.co.uk/forum/quest/topic/d1msq5hscemh9j2qmd0_cq/skill-buy-point-allocation (my first post in it, has the same link as the link above)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums