Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 12th, 2023, 05:04 PM
I am running into trouble with a particular item I am coding

It is a special armor that is easily enchanted with specific armor item powers, reducing the cost of such powers by half.

I have tried the following 2 scripts at First - 2550, but I get the error message:
Syntax error in 'eval' script for Thing 'mAMSAWvScl' (Eval Script '#1') on line 1
-> Script reference is invalid under the circumstances

Code:
  perform findchild[BaseItemPw,thingid.ipAMSAArFo?].setfocus
  focus.field[iPriceCash].value *= 0.5
Code:
  perform container.gizmo.setfocus
  if (focus.tagis[thingid.ipAMSAArFo?] <> 0) then
    focus.field[iPriceCash].value *= 0.5
  endif
I then tried this
Code:
  foreach pick in gizmo from BaseItemPw where "thingid.ipAMSAArFo?"
    eachpick.field[iPriceCash].value *= 0.5
  nexteach
which at least compiled but did not reduce the price and gave me this message
Attempt to access non-existent containing entity from script
- - -
Can't foreach over invalid container (this is probably related to a previous error)
- - -
Can't foreach over invalid container (this is probably related to a previous error)

Finally, it dawned on me that the armor type and the item powers are both gizmos on a magic armor pick, so I tried
Code:
  perform container.parent.setfocus
  perform focus.findchild[BaseItemPw,thingid.ipAMSAArFo?].setfocus
  focus.field[iPriceCash].value *= 0.5
and got the same error as the first 2 tries.

Is it possible to steer me in the right direction or at least to point me to an item that does a similar thing? I feel like I'm getting lost in transitions here. Thanks!
Lord Magus is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old August 13th, 2023, 07:33 AM
Am I to understand you want a set of armor to reduce the cost of things you add to it? In general, scripts can only affect things that are on the character already, so until you purchase the thing, you can't reduce the cost (AFAIK). That said, the error on your first script is likely due to missing quotes:

Code:
perform findchild[BaseItemPw,"thingid.ipAMSAArFo?"].setfocus
Although, come to think of it, it might also be the ? at the end. I think I've seen this before where you can use the ? alone, but not with something else, such as:

[thingid.?] = OK
[thingis.ipAM?] != OK

Also, when using setfocus, it's good practice to include the following line after:

Code:
doneif (state.isfocus = 0)

Last edited by Sendric; August 13th, 2023 at 07:37 AM.
Sendric is offline   #2 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 13th, 2023, 08:26 AM
Quote:
Originally Posted by Sendric View Post
Am I to understand you want a set of armor to reduce the cost of things you add to it? In general, scripts can only affect things that are on the character already, so until you purchase the thing, you can't reduce the cost (AFAIK).
Indeed, the set of armor is supposed to reduce the cost of armor powers such as air focus (a power in my campaign), so this is a gizmo affecting another gizmo by modifying its cost (iPriceCash) after it has been added, but before the item total cost is calculated and charged.

I have been able to manipulate the cost of an added weapon power in another instance; the script was on the power itself and referred to the weapon type. I may have to re-visit that again; I just had to establish focus on the parent container for that one (iMagWeapon or something like that), strangely enough, and not on the weapon gizmo itself.

Quote:
Originally Posted by Sendric View Post
That said, the error on your first script is likely due to missing quotes
My bad. Will correct this when I get home today.

Quote:
Originally Posted by Sendric View Post
Although, come to think of it, it might also be the ? at the end. I think I've seen this before where you can use the ? alone, but not with something else
I've read in the Wiki that you can use wild cards in this situation as it's a tag expression. But then, I forgot the quotes, so I may be a little over my head here!

Quote:
Originally Posted by Sendric View Post
Also, when using setfocus, it's good practice to include the following line
Indeed. I have not been used to this, it's the first time I delve into parent and gizmo stuff. Will do! Thanks!
Lord Magus is offline   #3 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 14th, 2023, 05:47 PM
Quote:
Originally Posted by Sendric View Post
That said, the error on your first script is likely due to missing quotes
Unfortunately, adding the quotes did not change the outcome.

Quote:
Originally Posted by Sendric View Post
Am I to understand you want a set of armor to reduce the cost of things you add to it? In general, scripts can only affect things that are on the character already, so until you purchase the thing, you can't reduce the cost (AFAIK).
In fact, the armor pick is is in a gizmo on the (hero) pick iMagArmor. The armor powers are in the same gizmo on iMagArmor. So what I am shooting for is to have a pick in the gizmo alter a field on another pick in the same gizmo (if it's there), before the final price for the item is calculated... or at least that's how I understand it.

Among my script attempts, the only two that compile without spitting out a syntax error are:
Code:
~ First - 2550 (altering iPriceCash must be done early)
foreach pick in gizmo from BaseItemPw where "thingid.ipAMSAArFo?"
  eachpick.field[iPriceCash].value *= 0.5
nexteach
but then, immediately, this message appears:
Attempt to access non-existent containing entity from script
- - -
Can't foreach over invalid container (this is probably related to a previous error)
- - -
Can't foreach over invalid container (this is probably related to a previous error)

Code:
~ First - 2550
perform gizmo.findchild[BaseItemPw,"thingid.ipAMSAArFo?"].setfocus
focus.field[iPriceCash].value *= 0.5
but then, immediately, this message appears:
Attempt to access non-existent containing entity from script
- - -
Attempt to access 'focus' pick or thing from script when no focus exists
- - -
Attempt to access 'focus' pick or thing from script when no focus exists

At least in the second case, I get that it does not "find" a suitable target pick.

And that is where I am stuck at the moment. I have read that you can only foreach on hero and gizmo, not parent or other containers, and attempts at these indeed ended up in errors. If anybody has other pointers (or can just confirm that what I am aiming for in fact cannot be done), I'll gladly take them. Thanks again!

Last edited by Lord Magus; August 14th, 2023 at 06:32 PM.
Lord Magus is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 15th, 2023, 09:47 AM
I just want to check a basic setting - you're sure you set up this new magic armor to have a gizmo?

At the bottom of the thing definition of the armor itself should be a child entry, like this:

<child entity="mSpecMagic">
<bootstrap thing="arBanded"/>
</child>
</thing>

Or if you're viewing this in the editor, the Gizmo button is among the grid of blue buttons on the right-hand side.


If you created the item on the Armor, Magic tab, it'll default to having a gizmo, but the error messages you're receiving suggest it doesn't have one.
Mathias is offline   #5 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 15th, 2023, 04:39 PM
Quote:
Originally Posted by Mathias View Post
I just want to check a basic setting - you're sure you set up this new magic armor to have a gizmo?
In fact not... the thing I am working on is a "regular" non-magical scale mail variant, made of wyvern scales.

When this non-magical armor is used to create a custom magic armor (on the Armor tab of a character) (i.e. when it is added as a gizmo to the iMagArmor pick), it reduces the cost of certain armor item powers that can be added along to it to iMagArmor. So it's the non-magical armor I'm creating, not a specific magic armor on the Magic armor tab of the editor.

When the base version of the armor is used, it's just a fine masterwork set of scale mail.
Lord Magus is offline   #6 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 16th, 2023, 04:32 AM
See attached pics to clarify...
Attached Images
File Type: png AWS Editor.png (133.0 KB, 1 views)
File Type: jpg AWS HL.jpg (162.8 KB, 1 views)
Lord Magus is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 16th, 2023, 07:04 AM
At this point, I recommend posting the entire thing element for this armor, copied from the .user file you've created - open that file in a text editor, and find the definition of this armor, and copy it and paste it here. As an example of what you're looking for, this is plain old studded leather:

Code:
<thing id="arStudded" name="Studded leather"description="An improved form of leather armor, studded leather armor is covered with dozens of metal protuberances. While these rounded studs offer little defense individually, in the numbers they are arrayed in upon such armor, they help catch lethal edges and channel them away from vital spots. The rigidity caused by the additional metal does, however, result in less mobility than is afforded by a suit of normal leather armor." compset="Armor">
<fieldval field="gWeight" value="20"/>
<fieldval field="gSizeCost" value="25"/>
<tag group="ArmorAC" tag="3"/>
<tag group="ArmorMaxDx" tag="5"/>
<tag group="ArmorCheck" tag="1"/>
<tag group="ArmorArcFl" tag="15"/>
<tag group="ArmorClass" tag="Light"/>
<tag group="EquipType" tag="MetalSome"/>
<tag group="EquipType" Leather"/>
</thing>
Mathias is offline   #8 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old August 16th, 2023, 10:43 AM
You may need to put an if statement in to prevent this from running until it's magical.
Sendric is offline   #9 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 16th, 2023, 04:08 PM
Quote:
Originally Posted by Sendric View Post
You may need to put an if statement in to prevent this from running until it's magical.
Did that with the "doneif" you recommended!
Lord Magus is offline   #10 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:27 PM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.