skill maintenance FO #22023

Parent Owner Flags Source rpg_march_2006/Features/Skill Maintenance FO.txt

Aliases: skill maintenance FO, smfo, @add-skill

5 verbs · 5 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
@sgs @show-governing-statsany none nonerxd#220239
@ags @add-governing-stat @addstatany to anyrxd#2202337
@rgs @remove-governing-stat @rmstatany from anyrxd#2202331
@addskillany any anyrx#2202352
feature_okthis none this#220231

Properties

PropertyDefinerFlagsOwnerValue
feature_verbs#22023{"@addskill", "@sgs", "@ags", "@rgs"}
key#22023not readable (E_PERM)
aliases#22023{"skill maintenance FO", "smfo", "@add-skill"}
description#22023"The power to be your best."
object_size#22023{7485, 1141286561}

Ancestry

Ancestors (nearest first): none

Children: none

Call graph

calls n22023_3 #22023:@addskill n4489_2 #4489:_create n22023_3->n4489_2

Source

@sgs @show-governing-stats

Spec any none noneFlags rxdDefiner #22023

Referenced by

none

Source

1"@sgs -- List stats which govern the success of this skill.";
2if (valid(skill = $local.rpg:match_skill(dobjstr)))
3  dep = skill.dependant;
4  attstr = (att = dep[1]) ? " the attributes " + $string_utils:name_and_number_list(att) | "";
5  sklstr = (skl = dep[2]) ? ((attstr ? " and " | "") + " the skills ") + $string_utils:name_and_number_list(skl) | "";
6  player:tell(tostr("Stats which affect the success of ", $string_utils:nn(skill), " include", attstr, sklstr, "."));
7else
8  player:tell(tostr("\"", dobjstr, "\" does not refer to an RPG skill."));
9endif

@ags @add-governing-stat @addstat

Spec any to anyFlags rxdDefiner #22023

Referenced by

none

Source

1"@ags  -- adds a stat as one that affects given skill's use";
2" Syntax:";
3"@ags stat to skill";
4"@ags stat,stat,stat to skill";
5{rpg, s_u} = {$local.rpg, $string_utils};
6if ((player != caller_perms()) && (caller != this))
7  player:tell("Permission denied.");
8  return E_PERM;
9elseif (!valid(skill = rpg:match_skill(iobjstr)))
10  player:tell(tostr("\"", dobjstr, "\" does not refer to any RPG skill."));
11  return E_INVARG;
12elseif (!rpg:is_grandmaster(player))
13  player:tell(tostr("If you have a suggestion for this skill, please contact ", s_u:title_list(rpg.grand_masters, "nobody", "or"), "."));
14  return E_PERM;
15elseif (!dobjstr)
16  player:tell(tostr("usage: ", verb, " stat[, stat ...] to ", skill.name));
17  return E_ARGS;
18endif
19good = bad = {};
20attributes = rpg.attributes;
21for try_ in (s_u:explode(dobjstr, ","))
22  match = s_u:trim(try_);
23  if (valid(object = rpg:match_skill(match)))
24    i = (object in attributes) ? 1 | 2;
25    skill.dependant[i] = object.dependant[2] ? listinsert(skill.dependant[i], object) | listappend(skill.dependant[i], object);
26    good = {@good, object};
27  else
28    bad = {@bad, ("\"" + try_) + "\""};
29  endif
30  rpg:s_i_f_i_n();
31endfor
32player:tell(good ? ((s_u:name_and_number_list(good) + " added as governing stats of ") + s_u:nn(skill)) + ".  " | "", bad ? (s_u:english_list(bad) + ((length(bad) == 1) ? " does" | " do")) + " not match any known RPG skills." | "");
33this:("@sgs")(dobjstr = skill.name);
34if (good && (caller != this))
35  rpg.skills:update_skills();
36endif
37"Irin Fri Sep  6 18:19:09 1996 PDT -- added call to :update_skills()";

@rgs @remove-governing-stat @rmstat

Spec any from anyFlags rxdDefiner #22023

Referenced by

none

Source

1"@rgs  -- removes a stat as one that affects given skill's use";
2" Syntax:";
3"@rgs stat from skill";
4"@rgs stat,stat,stat from skill";
5if ((player != caller_perms()) && (caller != this))
6  return E_PERM;
7elseif (!valid(skill = $local.rpg:match_skill(iobjstr)))
8  player:tell(tostr("\"", dobjstr, "\" does not refer to any RPG skill."));
9  return E_INVARG;
10elseif (!$local.rpg:is_grandmaster(player))
11  player:tell(tostr("If you have a suggestion for this skill, please contact ", $string_utils:title_list($local.rpg.grand_masters, "nobody", "or"), "."));
12  return E_PERM;
13endif
14attributes = $local.rpg.attributes;
15for try_ in ($string_utils:explode(dobjstr, ","))
16  match = $string_utils:trim(try_);
17  if (valid(object = $local.rpg:match_skill(match)))
18    if (object in $list_utils:flatten(skill.dependant))
19      i = (object in attributes) ? 1 | 2;
20      skill.dependant[i] = setremove(skill.dependant[i], object);
21      player:tell(tostr($string_utils:nn(object), " removed as a governing stat of ", $string_utils:nn(skill), "."));
22    else
23      player:tell(tostr($string_utils:nn(object), " isn't a governing stat of ", $string_utils:nn(skill), "."));
24    endif
25  else
26    player:tell(tostr("\"", match, "\" isn't an RPG stat."));
27  endif
28  $command_utils:suspend_if_needed(random(3) - 1);
29endfor
30this:("@sgs")(dobjstr = skill.name);
31$local.rpg.skills:update_skills();

@addskill

Spec any any anyFlags rxDefiner #22023

Referenced by

none

Source

1"@addskill name,propname[,alias ... ] with gov-stat[,gov-stat, ...] inj-pen,ins-pen,enc-pen,lrn-diff";
2usage = tostr("Usage: @addskill name,propname[,alias ... ] with gov-stat[,gov-stat, ...] inj-pen,ins-pen,enc-pen,lrn-diff");
3{rpg, s_u, l_u} = {$local.rpg, $string_utils, $list_utils};
4if (player != caller_perms())
5  return E_PERM;
6elseif (!rpg:is_grandmaster(player))
7  player:tell(tostr("You aren't allowed to create skills.  If you have a suggestion for a new skill, please contact ", s_u:title_list(rpg.grand_masters, "nobody", "or"), "."));
8  return E_PERM;
9elseif (!(names = s_u:explode(dobjstr, ",")))
10  player:tell(usage);
11  player:tell("You must specify a standard name and a property-name for the new skill.");
12elseif ((la = length(args)) < 3)
13  player:tell(usage);
14  player:tell("You must give at least one governing stat.");
15elseif (la < 4)
16  player:tell(usage);
17  player:tell("You must give the penalties/learn difficulty as shown above.");
18elseif (typeof(object = $recycler:_create(rpg.skill_object, rpg.owner)) == OBJ)
19  names = l_u:map_arg(s_u, "trim", names);
20  name = names[1];
21  aliases = listdelete(names, 1);
22  object:set_name(name);
23  object:set_aliases(aliases = setadd(aliases, name));
24  propname = aliases[1];
25  doll = rpg.doll;
26  if (typeof(adp = $add_property(doll, propname, 0, {doll.owner, ""})) == ERR)
27    player:tell(tostr("Error adding attribute property \"", propname, "\" to ", s_u:nn(doll), ": ", adp));
28    rpg.recycler:_recycle(object);
29    return adp;
30  endif
31  skilldb = rpg.skills;
32  if (typeof(adp = $add_property(skilldb, propname, object, {skilldb.owner, "r"})) == ERR)
33    player:tell(tostr("Error adding attribute property \"", propname, "\" to ", s_u:nn(skilldb), ": ", adp));
34    rpg.recycler:_recycle(object);
35    return adp;
36  endif
37  pvals = s_u:explode(args[4], ",");
38  pvals = l_u:map_arg(s_u, "trim", pvals);
39  pnames = {"injury", "insanity", "encumbrance", "learn"};
40  for p in [1..min(length(pvals), 4)]
41    pn = pnames[p];
42    pv = tonum(pvals[p]);
43    player:tell(tostr(s_u:nn(object), ".\"", pn, "\" set to ", pv, "."));
44    object.(pn) = pv;
45  endfor
46  this:("@ags")(dobjstr = args[3], iobjstr = object.name);
47  player:tell(tostr(s_u:nn(object), " created."));
48else
49  player:tell(tostr("Error creating skill object: ", object));
50endif
51rpg.skills:update_skills();
52"Irin Fri Sep  6 18:56:27 1996 PDT -- added call to update_skills.";

feature_ok

Spec this none thisDefiner #22023

Referenced by

none

Source

1return $local.rpg:is_grandmaster(args[1]);