PDA

View Full Version : Is there a way to make a Roll (Action) ignore targetting?



Varsuuk
May 17th, 2021, 22:21
I am doing this in MoreCore using the CAS rolls but any answer on any way to do it is fine :)

The issue is, I have a roll for saving throws that I customized (the same issue occurs with vanilla MoreCore "/sthrow 1d20>14" so it is not specific to my roll) where I just want it to be based on the "source" the one rolling. I do not care if there is a targeted entity by the one doing the roll.

Right now, it reports the results of the roll once per targeted entity.
After dinner, I will load up something like 5E and see what happens when I roll save targeting N npc. I am sure I never saw it roll multiple times so the answer is in there somewhere I am sure.

And THANK YOU TRENLOE for the other thread where you offered BMOS "printstack()" suggestion. I was reading the thread in case I could contribute when I was gifted with this functionality I didn't know existed.

If anyone knows any other cool trace/debug (other than console printing hehe) commands - feel free!

damned
May 18th, 2021, 00:03
Hi Varsuuk

There is no (enemy) target being added to the /sthrow roll. Only the save target - eg your roll over/under target.
If you dont want that to display then add a new roll I think would be easiest.

Or are you seeing something different?

Varsuuk
May 18th, 2021, 00:28
I was adding a new roll - but I went back and tested with /sthrow as well.

See if you see same thing. (I didn't see this happening with 5E, just tried, was trying to trace bu dinner now)

I created a simple char, added a /sthrow as I listed above with that target.
Created 2 NPCs, put all 3 on the CT.

Had the player char target the other 2 npc.
Pressed the roll button on the sthrow cas roll thing.

It rolled a result for each of the 2 targets (same dice)

----

Actually - no, DON'T try it yet ;) I should do it completely on Vanilla - just realized I did it in my SW ruleset using the original /sthrow roll. Maybe I messed something up in some place anyhow - let me do the legwork after dinner to try it on simple morecore if possible.

Sorry, I thought I tested it but realized it was a "mixed test" so too many variables to assert I "tried vanilla and it did same thing"

:)

Varsuuk
May 18th, 2021, 01:10
OK - verified.

Steps:

Create new Character.
Add a roll in "focus" (not that it matters where)
Make the roll /sthrow 1d20>14 (doubt specifics matter)

Create 2 NPCs. I created "NPC1" and "NPC2" without filling anything out on them except names.
Drag NPC1 &2 to CT.
Drag Char to CT

Click in Char's targeting icon.
Drag the target to both NPC1 and NPC2

Go to Character sheet and click on the new roll.

On my screen I see 2 exact dupes of the roll.

damned
May 18th, 2021, 01:21
ok i see that now
that is not actually being done in the roll but in the code that supports all the rolls...

i had a bit of a play but I dont have a simple way right now to stop that... I have to think about it some more.

damned
May 18th, 2021, 01:21
can you post a screenshot of that charsheet?

Varsuuk
May 18th, 2021, 01:57
Will later tonight - atm with Son and our ferrets ;) prob like 10PM EST so you can check it out tomorrow most likely

Varsuuk
May 18th, 2021, 04:10
[SOLUTION]
When calling something like this:
CustomDiceManager.add_roll_type(sCmd, performAction, onLanded, true, "all");

change it to:
CustomDiceManager.add_roll_type(sCmd, performAction, onLanded, true, nil --[[No Targeting]]);



Working on it - think on track to fix

EDIT:
Yup, got it to work on the roll with a one-line change (addition). Posting just so you know it is simple to do, I just need to see where it is currently being set to "all" (other choice checked in CoreRPG is "each") and see if can do in a cleaner way than needing to update each. That said, it may be we do that if we cannot add a param that defaults to old behavior (for those rolls that desire multi target and have it without explicitly coding for it)


local sCmd = "sthrow";



function onInit()
CustomDiceManager.add_roll_type(sCmd, performAction, onLanded, true, "all");
GameSystem.actions[sCmd] = { bUseModStack = true, sTargeting = "none" };
end


I added the above to the init of my /swsave roller.
I used "none" for giggles, setting it to nil or "Fred" would currently have the same effect. The CoreRPG code checks for all/each. Didn't check MoreCore yet in case it checks for others.
end


PS: Again, thanks to Trenloe for "printstack()"

=======
Final edit: lol - simple elegant fix. It is the "targeting" parameter in the PRIOR call above red ;)

Just change that to nil or any string but all/each like I did with "none" - BUT I'd suggest, nil for "nil targeting", that works great now that I know where it comes from.

damned
May 18th, 2021, 06:26
Thanks Varsuuk

That is the right spot to do it.
The options are "all", "each", nil (or maybe "none").

Varsuuk
May 18th, 2021, 06:31
Yuppers, it was staring me in the face, I mean really it was. But didn’t see it until saw the stack trace to “results handler” I think (or mod handler probably the latter not on pc atm)

Figure in MC you can next update change any non-target-related ones. I already did it for my save one and left as is for my thac0 and spells one.

Tomorrow, back to triggering saves (had to write that first forgot to lol) from spells (if save:yes paran) and I want to add tags like “first”, “death” optional la for when spell is other than “spells” save.

But first tomorrow is removing all the r debug stuff and gitting what I got done on my Ruleset.

CaptJack2883
May 20th, 2021, 09:07
If anyone knows any other cool trace/debug (other than console printing hehe) commands - feel free!


So I recently learned about Debug.chat() and Debug.console() that can be used instead of print() that gives different information about variables and what is in them. I was constantly getting blank lines for variables that obviously had information in them, but when I switched from print() to Debug.chat() I was able to see what was in them.

Moon Wizard
May 20th, 2021, 20:24
The print function purely outputs a string; so it doesn't know anything about the different variable types in Fantasy Grounds Lua. (And it's the oldest debug function from before my time.)
The Debug.chat and Debug.console functions are designed to accept any number of parameters, and attempt to output some information on every object type passed as a parameter.

Also, Debug.printStack will output the current Lua stack at the time the function is called. Useful for figuring out how a particular script function is getting called.

Regards,
JPG

Varsuuk
May 24th, 2021, 05:23
...

Also, Debug.printStack will output the current Lua stack at the time the function is called. Useful for figuring out how a particular script function is getting called.

Regards,
JPG

OMG is it!
Learning about this from that offhand comment made such a difference in my being able to speedily figure out code :)

Thanks for like 3rd or 4th time Trenloe ;)

damned
May 24th, 2021, 05:33
Ahem... the Moon Wizard is not the AI driven Trenloe.