¿ªÔÆÌåÓý

Re: DataSet Oddity


 

I should have been more clear. By "bunch of DSSet functions" I meant just the ones on the one branch of the If function.

I would have rewritten [AddItem} as

:AddItem
1, {Split~Result,"`",Item,QTY,XP,GP,Notes}
_|SavedIndex={DSFind~Treasure,0,Item=%Item%}|
_{If~%SavedIndex%<0?
_{DSAddNR~Treasure,Item,%Item%,QTY,%QTY%,XP,%XP%,GP,%GP%,Notes,%Notes%}
_|Index+1|/
_{DSSet~Treasure,%SavedIndex%,
_QTY,{Calc~{DSGet~Treasure,%SavedIndex%,QTY}+%QTY%}
_GP,{Calc~{DSGet~Treasure,%SavedIndex%,GP}+%GP%}
_XP,{Calc~{DSGet~Treasure,%SavedIndex%,XP}+%XP%}}

With just the one {DSAddNR} function if adding a new item and just the one {DSSet} function if updating the QTY, GP, and XP of an existing item


Erol K. Bayburt
ErolB1@...

On 4/29/2021 9:26 AM, Otaku Smurf wrote:
[Edited Message Follows]
Thanks.? I knew it had to be something I just wasn't seeing.
As for the {DSSet} functions, I am checking if what I am adding already exists, if it does, increase?the quantity, xp and gp.? If not, add the item, qty, xp, gp, and notes.
On Thu, Apr 29, 2021 at 3:45 AM ErolB1 via groups.io <> <ErolB1@... <mailto:[email protected]>> wrote:
The problem is in the [Display] group. In particular in the section
_|GP={DSGet~Treasure,%Index%,GP}|
_<td align="left" valign="top">{If~%XP%=0?{Color~White,__}/%XP%}</td>
_|XP={DSGet~Treasure,%Index%,XP}|
_<td align="left" valign="top">{If~%GP%=0?{Color~White,__}/%GP%}</td>
you've swapped GP and XP in the {DSGet} functions. It needs to be
_|XP={DSGet~Treasure,%Index%,XP}|
_<td align="left" valign="top">{If~%XP%=0?{Color~White,__}/%XP%}</td>
_|GP={DSGet~Treasure,%Index%,GP}|
_<td align="left" valign="top">{If~%GP%=0?{Color~White,__}/%GP%}</td>
As an aside, is there a reason you're using
{DSAddNR~Treasure} plus a bunch of {DSSet} functions
rather than
{DSAddNR~Treasure,Item,%Item%,QTY,%QTY%,XP,%XP%,GP,%GP%,Notes,%Notes%}
?
Erol K. Bayburt
ErolB1@... <mailto:ErolB1@...>
On 4/28/2021 8:28 PM, Otaku Smurf wrote:
> I have just noticed that my Datasets are either not setting
correctly,
> or not getting correctly.? Most likely, I have something off in
my code
> and can't see it.
>
> I've put in an "error" check.? So, the 1st 3 lines are what is being
> returned for addition to the dataset.? The table is the output
and for
> some reason, "Experience" is offset by 1.
>
> -1; 1; (A1)Scroll of 2 Wizard Spells;1;0;0
> -1;2;Protection from Undead;1;1500;7500
> -1;3; Potion of Extra-Healing;1;400;800
> Treasure? ? ? Quantity? ? ? ? Experience? ? ? Gold Value? ? ? Notes
> (A1)Scroll of 2 Wizard Spells? ? ? ? ?1? ? ? ?400? ? ?__
(L4) Tenser's Flaming Blade (GA)
> (L2) Wings (7S)
> Protection from Undead? ? ? ? 1? ? ? ?__? ? ? 7500? ? __
> Potion of Extra-Healing? ? ? ?1? ? ? ?1500? ? 800? ? ?__
>
>
> I've spent 2 days trying to figure this out on my own, and I am
at a loss.
>
> Thanks.
>

Join [email protected] to automatically receive all group messages.