View Single Post
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 468

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