Elliott wrote:
> When I run the script, I find that 'priorities is missing an item. Is
this a problem with my usage of remove?
Yes! Kind of.
> I'm trying to remove the value found in 'priorities/magic from the
list of available priorities 'pri-list. The same procedure is working
for priorities/race, but somewhere I'm losing 'priorities/magic as a
block item of priorities.
>What's going wrong?
>From srcg2.r:
> pri-list: ["a" "b" "c" "d" "e"]
> remove pri-list :priorities/race
You need to find the value in pri-list first. Like this:
>> pri-list: ["a" "b" "c" "d" "e"]
== ["a" "b" "c" "d" "e"]
>> remove find pri-list "e"
== []
>> pri-list
== ["a" "b" "c" "d"]
Or better:
remove find pri-list priorities/race
You've got this:
> priorities: [
race
magic
atributes
skills
resource
]
I would prefer using an object, like this:
Priorities: make object! [
Race: none
Magic: none
Attributes: none
Skills: none
Resource: none
]
Also, this:
> pri-list: ["a" "b" "c" "d" "e"]
is probably better expressed as:
Priority_List: [a b c d e]
This:
> ch-race: to-string ask "What is the character's race (human, elf,
dwarf, ork, troll)? "
> if find races ch-race [true]
seems nicer as:
Character_Race: ask ...
found? find races Character_Race
This:
> either ch-race = "human" [priorities/race: "e"] [priorities/race:
"a"]
remove pri-list :priorities/race
works better as:
Priorities/Race: either Character_Race = 'human ['e] ['a]
remove find Priority_List Priorities/Race
These lines:
> mage: to-string ask "Is this a mage or adept (mage, adept, none)? "
> if (mage = "mage") [priorities/magic: first pri-list]
> if (mage = "adept") [priorities/magic: second pri-list]
> if (mage = "none") [priorities/magic: last pri-list]
> remove pri-list :priorities/magic
might be better as:
Mage: ask "Is this a mage or adept (mage, adept, none)? "
Priorities/Magic: switch/default Mage [
"Mage" [first Priority_List]
"Adept" [second Priority_List]
"none" [last Priority_List]
][last Priority_List]
remove find Priority_List Priorities/Race
Of course, that's just my opinion. Feel free to disagree.
I hope that helps!
Andrew Martin
Never deal with a dragon...
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-