The Not-Bob Factory

Heya all, bit of a strange question today: Trying to name clones.

If I have an NPC factory and it has a command where the player can generate NPCs called Bob (or any other object, really) eery time the command is used, the object Bob is cloned. I'm sure the way Quest works this means you get a Bob1, Bob2 or something along those lines. It's always the same Bob, with the same functionality and such.

But then, my question is making them have a different name. So the get input can be used to give the Bob a new name. Say the player uses the command, gets their very own Bob and wants to call it Harold or Gzztsg. And then they hit again, the Bob2 object comes out but we want the player to be able to rename is John or PrincessSparkelle. I know how to change an alias, as I've already got the player picking their name, but is there a way to reliably be able to give a cloned object a chosen name each time?

Long story short, is there a way to easily change the alias for an object's clone each time it's made?

Bonus Question:

Further on the subject of get input, say you give the player a choice to enter something like pick their sex, male or female. And they enter, being players, 'cat'. Cat isn't either male or female, so of course this screws up the whole thing. Player will get a message saying something along the lines of, "That's not an acceptable sex, try male or female." But then I need to repeat the function that they've just screwed up, or they're left hanging at a screen.

Is there a way to do this mid-script? For some clarification, the player's character creation runs as a start script for the game itself, so it already has the intro play, pick eye colour, skin colour, hair colour, etc, then choose their sex. The only way I can think of it being able to be repeated is to have it as a function and recall it. Is this the best method to do, or is there some way to... Go back a turn in a script? Re run the get input when the wrong information is given?


Long story short, is there a way to easily change the alias for an object's clone each time it's made?

Are you wanting to give the clone a random name when it is created? The simple way would be to have list, and pick from that. It you remove the entry from the list after each pick, you can stop duplicates, but you would need to check that the list had not run out.

Alternatively, a function that makes random syllables from a set of starting sounds (b, br, bl, c, cl...), vowels (a, ae, ar, ah...) and end sounds (b, bb, c, ck...). Then a function that makes words from syllables.

But then I need to repeat the function that they've just screwed up, or they're left hanging at a screen.

Simple way is to use ShowMenu, and just stop them putting in garbage. That is what I would do.

If this is part of an NPC factory, you could have a switch, and allow the player to flip it to male or female. In fact, now I think about it, that would be pretty cool; that would be how I would do it.

Otherwise, you are into recursion. See the second half of this:
http://docs.textadventures.co.uk/quest/asking_a_question.html


Not a random name, a player given name using the get input function.

The second part was more the player sex selector on starting the game. I was considering the Show Menu and originally used this, but was told by a tester that it felt a bit clunky to have the player type their skin colour, eye colour, and hair colour then have them need to type 1 or 2 or pick from a hyperlink to select their sex.

My character creation is quite flexible by the fact it allows any hair, skin or eye colour to be added by typing in the word; black, raven, red, blue, cyan, white, stripy green (although more complex colouring might not fit well with text in some scenes) Even though sex selection is still A or B, it would be more fitting for my theme. Recursion seems more complex, so I might instead make sex selection a function and allow it to be recalled if things go wrong.


would this work (and be of any help)?

(ask about any part of it if unclear on what it does)
(too lazy to document/comment on within it)

// scripting:

msg ("Original Object Name?")
get input {
  if (not IsNumeric (result)) {

    original_object_string_variable = result
    create (original_object_string_variable)
    set (original_object_string_variable, "parent", original_data_object)
    set (original_object_string_variable, "clone_type_string_attribute", original_object_string_variable)

    clone_data_object_string_variable = original_object_string_variable + "_clone_data_object"
    create (clone_data_object_string_variable)
    set (clone_data_object_string_variable, "parent", clone_data_object)
    set (clone_data_object_string_variable, "clone_quantity_integer_attribute", 0)

    msg ("Clone Quantity?")
    get input {
      if (IsInt (result)) {
        clone_quantity_integer_variable = ToInt (result)
        
        modify_alias_boolean_variable = false
        ask ("Modify Alias?") {
          if (result) {
            modify_alias_boolean_variable = true
          }
        }
        
        for (not_used_count_integer_variable, 1, clone_quantity_integer_variable) {
          clone_object_variable = CloneObject (original_object_string_variable)
          set (clone_object_variable, "parent", clone_data_object_string_variable)

          clone_ending_number_string_variable = Mid (clone_object_variable.name, LengthOf (original_object_string_variable) + 1)
          set (clone_object_variable, clone_ending_number_string_attribute, clone_ending_number_string_variable)

          clone_ending_number_integer_variable = ToInt (clone_ending_number_string_variable)
          set (clone_object_variable, clone_ending_number_integer_attribute, clone_ending_number_integer_variable)

          clone_data_object_string_variable.clone_quantity_integer_attribute = clone_data_object_string_variable.clone_quantity_integer_attribute + 1

          if (modify_alias_boolean_variable) {
            msg ("Alias?")
            get input {
              alias_string_variable = result
              set (clone_object_variable, "alias", alias_string_variable)
            }
          }
        }
      }
    }
  }
}

// required Objects for the above scripting:

<object name="global_data_object">
  <object name="original_data_object">
  </object>
  <object name="clone_data_object">
  </object>
</object>

@ JK:

Here's some types of designs:

  1. user typed-in input (some freedom: open choices, but with whatever restrictions: such as 'length / character length'): 'get input' Function and/or Commands
  2. using the popup window menus (little freedom: forced choices)
  3. using the "in-line" (clickable hypertext in big text box area) menus (little freedom" forced choices)
  4. using the right pane's clickable 'buttons' (Verbs)
  5. using typed-in input (number of your choice) for your lists, instead of using (popup windows and "in-line" hypertext) menus (little freedom: forced choices)

for my own character creation and game, I'm doing #5, as it's fast (type in the number of your choice), but requires some coding. Though, I'll also have some other designs (mainly #4) available at the same time too, for most game stuff.


I'm (still) working on character creation myself, for my own game...

here's some things I'm doing, you might like to use them and/or they could give you some ideas:

Names: first, middle, last, preferred, nick, full name
Titles: marital, nobility/royalty, accomplishments/fame/infamy, etc
Sex: male, female
Full Age String: zygote, embryo, fetus, baby, child, teen, adult, corpse
Living Age String: zygote, embryo, fetus, baby, child, teen, adult
Dead Age String: corpse
Born Age String: baby, child, teen, adult
Unborn Age String: zygote, embryo, fetus
Playable (main character: a baby can't play a game, lol) Age String: child, teen, adult
Age Integer: (number of age)

Biology Taxonomy:
(old numonic for memorizing: "K-ing P-aul C-ried O-ut F-or G-ood S-oup: Kingdom, Phylum, Class, Order, Family, Species)
-> life: organic, inorganic
->-> domain: (organic domain: eukarya, prokarya), (inorganic domain: robot, machine, droid, android, cyborg, golem)
->->-> kingdom: (eukarya kingdom: animal, plant, ~fungus), (prokarya kingdom: bacteria, virus, protista, priors, archaea, ~fungus)
->->->-> Phylum: (animal Phylum: chordata-vertebrates)
->->->->-> Class: (chordata class: mammal, bird, reptile, amphibian, fish)
->->->->->-> Order: (mammal order: primates, carnivores, herbivores)
->->->->->->-> Family: (primate family: ape, monkey)
->->->->->->->-> Genus: (ape genus: homo-humanoid, pan-chimp, gorilla-gorilla, pongo-orangutan)
->->->->->->->->-> Species: (homo species: human-modern human-homo sapien sapien, neanderthal, homo erectus, homo habilis, etc etc etc ape-to-man evolution and/or other ancient homo ancestors)
->->->->->->->->->-> Race (genetically no such thing as race): (human race: european, african, asian, arabian, american, australian)

Mythical (<--- group name not set): Elves (Ljosalfar: light elves, Dokkalfar: dark elves, Svartalfar: black/night elves), Dwarves, Gnomes, Halflings, giants

Monsters: orcs, ogres, trolls, goblins, gremlins, cyclops

Hybrids: centaurs, minotaurs, harpies, satyrs, mermaids, ~vampires, ~(werewolves / lycans), (nagas, lamias, gorgons),

Supernatural (<--- group name not set): ~vampires, ~ (werewolves / lycans), ???

Undead: skeletons, ghouls, zombies, ghosts, wraiths, wights, specters, liches, spirits, death knights,

Angelic: angels, cherubims, seraphims

Demonic: imps, (demon / demoness), (incubus / succubus), devil, hellhound

Magical: fae (fairy / faerie), pixie, sprite, nymph, siren, ~dryad, ~golem

Mechanical: robot, machine, droid, android, cyborg, ~golem

~Mystical, ~Fantastical

Skin:
-> Skin Type: skin, fur, feathers, scales // (yes, these are actually all skin, as skin is able to become these 4 things and a 5th/6th thing too: fingernails/horns-ivory. Skin is also the largest organ, yes it's considered a single organ)
-> Skin color: (humans: fair, light, olive, tanned, medium, dark, ebony)

Eyes:
-> eyeball color: (humans: white)
-> iris color: (humans: light blue, medium blue, dark blue, light brown, medium brown, dark brown, light green, medium green, dark green, yellow, yellow brown, blue green, yellow green brown, grey, blue grey)
-> Pupil
->-> Pupil color: (humans: black)
->-> pupil shape: (humans: circular), (felines/serpents: vertical)
-> eye type: (humans: non-asian, asian)

Nose
-> Nose Size: small, average, large
-> Nose Length: short, average, long
-> Nose Width: narrow, average, wide
-> Nose Type/Height: flat, pointy/protruding

Mouth Size: small, average, large

Lips
-> Lip Size: thin/small, average, thick/large
-> Lip color: ?red, pink, purple, etc?

Ears
-> Ear Size: small, average, large
-> Ear Type: (humans: rounded), (elves: pointed)

hair
-> hair type: none, straight, wavy, curly, ~tangled
-> hair style: bald, spiked, mohawk, bunned, braided, ponytail, pigtail, loose, afro, deadlocks,
-> hair color: (humans: black, white, light grey, medium grey, dark grey, light brown, medium brown, dark brown, light yellow, medium yellow, dark yellow, golden yellow, red, red yellow, orange)
-> hair length: zero, very short, short, average, long, very long
-> hair width: zero, fine, thin, average, thick
-> hair growth: zero/none, very slow, slow, average, fast, very fast

height: short, average, tall
weight: light, average, heavy

muscle: scrawny, average, brawny
fat: skinny, lean, average, chubby, fat, obese

looks/attractiveness/sexuality: ugly, average, sexy

specialization: combat (melee/non-projectile, projectile/ranged), magic, stealth, diplomacy, science, faith

combat classes: warrior, barbarian, knight, berserker, paladin, ranger, marksman, warlord, pirate, amazon, valkyrie, ninja, monk, samurai, crusader, infidel,

magic classes: wizard, witch, warlock, necromancer, sorcerer/sorceress, mage, magician, druid, sage, summoner, conjurer, enchanter/enchantress

faith classes: cleric, priest/priestess, exorcist, nun, monk, crusader, infidel, cultist, bishop, pope, cardinal, pilgrim

diplomacy classes: bard / muse, politician, seducer/seductress, diplomat, ambassador, emissary,

science classes: chemist, biologist, botanist, zoologist, alchemist, magician, philosopher, economist, sociologist, psychologist, physicist, physician, mathematician, programmer, hacker, engineer, mechanic, politician,

attributes: strength, endurance, dexterity, agility, speed, luck, piety, intelligence, spirituality, mentality, personality, leadership, charisma, alignment, morality, sexuality, creativity, vitality,


(etc etc etc --- getting tired, lol)


JK's bonus question:

the easiest way is to use Functions (or less easy: Object's Script Attributes + Delegates), as this let's you call them (specifically: do them again, simpliest is via; simple looping / tail-recursion, slightly more difficult: 'while' looping, difficult: recursion, very difficult: using data structutes: trees, maps, dictionaries, linked lists/chains, hashing, stacks, queries, etc)

for example:

(using Functions, as they're quicker/easier to use)

<game name="example_game">
  <attr name="start" type="script">
    character_creation_function
  </attr>
</game>

<function name="character_creation_function">
  sex_function
  on ready {
    age_function
  }
</function>

<function name="sex_function">
  msg ("Sex?")
  get input {
    if ("male") {
      player.sex = "male"
    } else if ("female")
      player.sex = "female"
    } else {
      msg ("wrong input, try again")
      sex_function
    }
  }
</function>

<function name="age_function">
  msg ("Age?")
  get input {
    if (IsInt (result) and ToInt (result) > 3 and ToInt (result) < 70) {
      player.age = ToInt (result)
    } else {
      msg ("wrong input, try again")
      age_function
    }
  }
</function>

here's more examples/ideas (I was stupid at the time, didn't realize to use a single Function and Parameters, and thus I instead made a lot of redundent Functions, lol):

http://textadventures.co.uk/forum/samples/topic/4988/character-creation-crude-code-and-sample-game

(this is my old code work, using user typed-in input and lists, so it's a bit more advanced, but see if you can kinda get it, and if not, let me know, and I can try to help you with understanding it, if you don't or aren't able to, as List/Dictionary Attribute usage is quite a step up in coding)


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

Support

Forums