Senior Member
Join Date: Jun 2014
Posts: 243
|
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? |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
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.
|
#2 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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: Quote:
the entity is: Code:
<entity id="grBuyType"> <bootstrap thing="btBuyType"/> </entity> Code:
<child entity="grBuyType"> </child> Code:
gizmo.child[btBuyType].field[btBuyType].value = 1 Last edited by ShadowWalker; July 17th, 2016 at 02:44 PM. |
|
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
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] |
#4 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
So the creation script sets the field and an eval script assigns the tag?
|
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
|
#6 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
Thanks got it working
|
#7 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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 by ShadowWalker; July 18th, 2016 at 09:17 PM. |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
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).
|
#9 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
Thanks again.
|
#10 |
|
|