• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

assigning tags to newly purchased items

ShadowWalker

Well-known member
I want to assign a tag to a pick after it has been purchased based on what was selected in a menu item on the buy template.

I have items that have a Quality (similar to cyberware grades in shadowrun) and I thought the best way to deal with it was with assigning a tag at the time of purchase.

I was originally thinking of doing it in the Transact Buy script but it can't done there since it's not a pick at that point. Where would I be able to still see what was selected on the template and be able to access the pick to add a tag?
 
Shadowrun does that with a pick inside the cyberware's gizmo. The xactbuy script sets the value of a drop-down field on that pick, based on the cyberware grade that was set by the user in the buy template, and then a script on that pick assigns the correct tag.
 
So I created an entity, and have a bootstrap of a thing with a field for storage.
When I try accessing the gizmo.child etc I got the following error:

Attempt to access non-existent containing entity from script
Location: Procedure 'XactBuy' near line 20

I'm guessing this means either the child doesn't exist within the gizmo or that the gizmo container doesn't exist.

the entity is:
Code:
  <entity
    id="grBuyType">
    <bootstrap thing="btBuyType"/>
  </entity>

each thing to be purchased has:
Code:
    <child entity="grBuyType">
    </child>

The code being used to set the field is:
Code:
      gizmo.child[btBuyType].field[btBuyType].value = 1
 
Last edited:
I apologize, I was working from memory, and forgot where the script was.

There's a compset specifically for the helper picks, and those have a creation script that applies this sort of thing.

Here's the relevant lines from that creation script:

Code:
searchexpr = "Augment.Cyber & " & hero.transact.field[xactChCyb].chosen.tagids[explicit.?,"|"]

perform field[usrChosen1].setchosen[Grade,searchexpr,hero]
 
So I got it working, but I didn't like the way I was doing it.
I'm trying to change it to work with a menu of things, which is what it looks like what you posted is doing.
Grade = component or compset of the things/picks to search for
hero = container for the picks? If this is the case what if you are using things?
 
Last edited:
In setchosen, the first argument is the Component that menu chooses from. The second argument is an expression that tells it how to pick a specific item from that compset. The third argument must be either "hero", "container", or "thing", which tells HL where to apply that expression. You'll use the same setting there as your <menu_things> in the portal for this field uses for its usepicks="XXXXX" setting (and the first argument will match the component="XXXXX" in that portal).
 
speaking of menu_things... Since I've changed to this from menu_literal the default is no longer being set. I found defthing but setting that to the id of the thing I want as the default is not setting the menu to that item.

Code:
    <portal
      id="buyType"
      style="menuNormal"
      tiptext="Select how this item will be purchased.">
      <menu_things
        field="xactBuyTyp"
        component="MenuItem"
        defthing="miStandard"
        sortset="Menu">
        <candidate>
          <![CDATA[
            Helper.BuyMenu
          ]]>
        </candidate>
      </menu_things>
    </portal>

The thing I want as the default is in the menu when I check it. It's just not being selected as the default.
 
miStandard is a pick that's always bootstrapped to characters?

Since this menu is currently set up to look at picks on the hero, make sure miStandard is there for it to select from.
 
I added Helper.Bootstrap to the menu item component and usepicks="hero" to the thing menu and I'm getting the same result. The menu list is being populated but the default is not being set.
 
defthing has always been unreliable, in my experience. I'm sorry, but I won't be able to look into the details of this one until after Gen Con. Figuring out what's going wrong is going to take some detailed investigation, and I may need to install the game you're writing in order to test things in place.
 
One thing to check - do a full re-compile of the game system by using Switch Game System and then coming back to the same system or closing and restarting HL. ctrl-r may not catch changes in defthing.
 
I've got some time now that I'm back from Gen Con, and I'm mostly caught up on various things. Try using hlexport to package this game system up into a download you can post here (or send to me by email - my address is my user name here, @wolflair.com).

I think this will be easiest for me to figure out if I can test and edit what you're working on.
 
Back
Top