1. #1

    Quick "target" naming related question - using 2E code example

    So, I got my saving throws setup code wise for classes/races leveling (inc multiclass/dual) where base and bonuses are filled in/updated.

    I went to activate "rollable" aspect.
    Grabbed a fast example in 2E just to start. Printed via console some of the variables mentioned in that method in my own "stub" action (called from double-click) method just to see what I have.

    I remember in early API docs a page where referencing xml (ie: using that [1] thing) is explained and I will refresh myself tomorrow reading it (allergies and 1AM ).
    Just had a question - is "target" the accepted element name to use (recall it often) anytime you basically want to do a "this"/name type key lookup? In the example below it takes the expected base path and inserts the "target" to build complete path.

    If so, I will continue to use it. Otherwise, I'd replace it with per-use naming like: "<savecategory>devices</savecategory>" etc?


      <template name="number_charasavescore">
          <anchored to="statstitle" position="below"/>
          <rollable />
            function action(draginfo)
              local nTargetDC = 20;
              local rActor = ActorManager.getActor("", window.getDatabaseNode());
              local sActorType, nodeActor = ActorManager.getTypeAndNode(rActor);
              nTargetDC = DB.getValue(nodeActor, "saves." .. self.target[1] .. ".score", 0);
              ActionSave.performRoll(draginfo, rActor, self.target[1],nTargetDC);
              return true;
            function onDragStart(button, x, y, draginfo)
              return action(draginfo);
            function onDoubleClick(x,y)
              return action();

  2. #2
    There's no standard really for that stuff. Using a "target" or "source" tag is the most common implementation I have seen; and what is used in most of the rulesets I do.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Log in

Log in