Form API – form ID value changing which breaks the action# link

I have a custom module creating a form. As the form is a bit down the page, I have added an anchor to the submit so the user sees the results without the need to scroll down

  public function getFormId() {
    return 'form_name_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state, $entity_id = NULL) {
    $form('#action') = '#form_name_form';
    //.. rest of form removed for clarity
  }

This works and then it does not… I can see why:

<form class="form_name_form" data-drupal-selector="form_name_form" action="#form_name_form" method="post" id="form_name_form" accept-charset="UTF-8">

Becomes

<form class="form_name_form" data-drupal-selector="form_name_form-2" action="#form_name_form" method="post" id="form_name_form--2" accept-charset="UTF-8">

But I am not sure how to stop the addition of ‘–2’ to the ID?
Or set $form(‘#action’) = ‘#form_name_form’; to the actual generated form id?

dnd 5e – Does Mind whip prevent bonus actions if you take away an action?

The text for mind whip states

You psychically lash out at one creature you can see within range. The target must make an Intelligence saving throw. On a failed save, the target takes 3d6 psychic damage, and it can’t take a reaction until the end of its next turn. Moreover, on its next turn, it must choose whether it gets a move, an action, or a bonus action; it gets only one of the three. On a successful save, the target takes half as much damage and suffers none of the spell’s other effects

Meanwhile, the rules state

[…] anything that deprives you of your ability to take actions also prevents you from taking a bonus action.

If the target chooses a bonus action, it technically shouldn’t be able to do so, as it was deprived of its action. Or is this a case of specific beats general?

how to reference external file in custom ribbon action using CSOM (JSOM)?

Environment: SharePoint 2013

I am using this script to add a custom action button. There are a few things which I would like to achieve:

1- how can I externalize javascript into a file and call a method defined in that file from commandAction like this:
CommandAction="javascript:myFunction();"

2- how can I delete this custom action button from the ribbon? I do not want it to be hidden.

3- how can I target File tab in Document Library?

<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script language="javascript" type="text/javascript">  
    $(document).ready(function() {  
        SP.SOD.executeOrDelayUntilScriptLoaded(AddCustomUserAction, "sp.js");  
    });  
    var oListItem;  
  
    function AddCustomUserAction() {  
        //Get the client context and list object  
        var context = new SP.ClientContext.get_current();  
        var list = context.get_web().get_lists().getByTitle("Check List");  
        //Get the custom user action collection and add the user action  
        var customUserAction = list.get_userCustomActions().add();  
        //Set the location of the user action  
        customUserAction.set_location('CommandUI.Ribbon.ListView');  
        //Add the properties for the custom action  
        var userActionExtension = '<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">' + '<CommandUIDefinitions>' + '<CommandUIDefinition Location="Ribbon.List.CustomizeList.Controls._children">' + '<Button Id="Ribbon.Documents.New.RibbonTest" ' + 'Command="Notify" ' + 'Sequence="0" ' + 'Image16by16="/_layouts/images/NoteBoard_16x16.png" ' + 'Image32by32="/_layouts/images/NoteBoard_32x32.png" ' + 'Description="Shows the ID of the current list." ' + 'LabelText="Show List ID" ' + 'TemplateAlias="o1"/>' + '</CommandUIDefinition>' + '</CommandUIDefinitions>' + '<CommandUIHandlers>' + '<CommandUIHandler Command="Notify" ' + 'CommandAction="javascript:SP.UI.Notify.addNotification('ListId={ListId}');" />' + '</CommandUIHandlers>' + '</CommandUIExtension>';  
        //Add the command UI extension and update the custom user action  
        customUserAction.set_commandUIExtension(userActionExtension)  
        customUserAction.update();  
        //Load the client context and execute the batch  
        context.load(list, 'UserCustomActions');  
        context.executeQueryAsync(function() {  
            console.log("Custom User Action added successfully to ribbon.");  
        }, function(sender, args) {  
            console.log(args.get_message());  
        });  
    }  
</script>  

dnd 5e – If I ready a action (spell) in response to a companion’s attack, what is a fair GM rulling over the order of events?

@Medix2 proposes a well-cited answer for the RAW scenario, but I will propose some solutions to turn this ruling in your party’s favor.

The cleric is putting a lot on that readied action: concentrating until their trigger occurs, and the potential loss of a spell slot if the trigger doesn’t occur. I think there are opportunities here to translate your cleric player’s intent into the game such that it both works the way they want, and plays nicely enough with the RAW.

From ‘Other Activity on Your Turn’ in the basic rules:

[…] You can communicate however you are able, through brief utterances and gestures, as you take Your Turn. […]

One way you could make this work, and potentially invite some combat roleplay, is to rule that the characters need to verbally coordinate such attacks, or create some other system of communicating this intent. The cleric holds their spell for the fighter’s signal and yells to the fighter ‘Let me know when!’; then the fighter, on their turn, yells to the cleric “Now!” while making a mad dash toward their target, sword in tow. This seems a clear enough ‘perceivable circumstance’ to act as a trigger, and eliminates the vague wording of “when the fighter starts to attack”.

If you have particularly roleplay-averse players, or if you want to introduce this method to them naturally, this character interaction could be described by you, the DM, to explain how the intended actions of the players can actually play out in the world in a way that is friendly with the rules. I feel that this is likely the best solution, as it both explains why the previous trigger didn’t work and sets a model to translate player intent to character action moving forward.

This ruling is less strictly rules-friendly, but is the way I rule readied action triggers in my own games. The term ‘perceivable circumstance’ is not a defined game term, and is subject to your interpretation. Because of this, I would allow an ambiguous trigger such as ‘when X starts to attack’, but consider the triggered spell/attack/movement a simultaneous effect with the attack. Xanathar’s Guide proposes an excellent way to handle Simultaneous Effects in Chapter 2:

[…] If two things happen at the same time on a character or monster’s turn, the person at the game table – whether player or DM – who controls that creature decides the order in which those things happen. […]

If you handle it this way, then the fighter can choose to allow the bolt to go off before their attack. And, as a bonus, if the cleric attempts to ready their action for when an enemy is about to attack, that enemy will probably decide that their attack resolves first, as the original readied action rules would have dictated. In RP terms, a cleric and a fighter who have been travelling and fighting together for some time would likely understand each others’ intents in combat better than they’d understand that random enemy they stumbled upon; in short: coordinating with teammates is easy, but enemies are unpredictable. This ruling changes very little about how readied actions work, yet allows a lot of Rules as Fun combat interactions that might not otherwise work.

vampire the masquerade – What happens if a character’s declared action becomes impossible?

The action is wasted, at least as it was intended

The major basis for that statement is that combat rounds in V:tM are three-second slices of time with simultaneous actions. The initiative order is used both to make that more manageable (it’s hard to track and interact with 10 characters operating at the same time!) and to simulate the advantages held by characters who are faster than others. Consider this excerpt:

Although you declare your character’s action now (this is the Initiative phase)
(including stating that your character delays her action
to see what someone else does), you wait until
the attack stage to implement that action. At this
time, you must also state if any multiple actions will
be performed, if Disciplines will be activated, and/or if
Willpower points will be spent. Characters declare in
reverse order of initiative, thus giving faster characters
the opportunity to react to slower characters’ actions.
(V20 Core Rulebook, page 271)

Emphasis mine. It is explicit that the purpose of declaring actions in reverse initiative order is to allow faster characters to undercut slower characters’ efforts. It doesn’t fit too well with that to allow a slower character to declare an action, have it thwarted, and then freely choose a different action all in the same 3-second window.

Portions of an action may still be possible, as in the “intending to run through a door which is suddenly closed”. You may not be able to run through the door, but I would almost certainly rule that you still run up to it before it slams shut in your face.

Narration is important. This is a game under the Storyteller system! A situation like the one described in the question, while not too common in my experience, allows for tense and exciting encounters.

When two vampires are fighting in the Deadlands, one doesn’t disappear through the Shroud back to the living world and then after a pause their opponent starts shooting at where their target used to be in frustration. It all happens at once, and the disappearing character acted just a hair more quickly than the other one. The narrative-focused Storyteller system is probably better served by something like:

Lucretia levels her pistol at Augustus and pulls the trigger three times, with three precise, controlled motions. But as the bullets fly towards Augustus, he seems to fade away. In the fraction of a second it takes the bullets to reach Augustus’ former position, there is nothing there to hit!

differential geometry – Justify the action functional

The action functionals in physics always seems weird to me. In this thread, I hope to formally justify them by arguing that for all kinds of dynamical systems, such magical functional exists.

Suppose $M$ is a smooth manifold, and $M xrightarrow{f_t} M$ is a one-parameter family of diffeomorphism, with $f_0 = 1_M$. Denote $P(M)$ by the free path space of $M$.

Question. Does there exist a function $P(M) xrightarrow{S} mathbb{R}$ such that

  • $S(gamma_1 ast gamma_2) = S(gamma_1) + S(gamma_2)$, where $ast$ denotes the concatenate operator and the $gamma_i$‘s are concatenatable.
  • $frac{delta S}{delta gamma} = 0$ for all $gamma$ traced out by $f_t$?

If so, how large is the solution space for such $S$?

Run script/automator action from bluetooth event

I’ve just started using a new pair of wireless headphones, that have some assistant magic integrated. That works great on my phone, but on my Mac it does nothing (or, it tries to do something to Siri, but she’s not really around)

I’d like to somehow map that action to something else – preferably something I can customize to my needs.

From the Console app, I can see that at least 2 bluetooth events happen when I do this – handsFree:siriStatus and handsFree:activateSiri, both under the bluetoothaudiod process. Is it possible somehow to react to these bluetooth events, or are their actions hardcoded in the OS?

starfinder – Does the use of a gunner major action always preclude the use of the Snap Shot minor crew action?

In Starfinder, during starship combat, the Snap Shot minor crew action allows a crew member who has taken a major crew action earlier in the round to fire a starship weapon during the gunnery phase. The rules state:

You can fire one of your starship’s weapons with a –2 penalty to the gunnery check. You can take this action only if no other gunner actions have been taken during the gunnery phase (including snap shot).

The wording of the second sentence raises questions. Does it disallow Snap Shot actions completely if another character intends to take a gunner major action? Does it disallow Snap Shot actions unless they’re taken before all gunner major actions for the round? Or does it simply disallow Snap Shot if the character attempting it has already carried out a gunner major action?

The scenario I am facing in play is this: a pilot has completed a pilot major action in the Helm phase and positioned the ship to put the enemy ship in the port quadrant. There are two gunners on board. The first gunner has fired at the enemy ship with a turreted weapon. The second gunner has fired at the enemy ship with a port arc weapon. The pilot’s player points out that the ship also has a forward arc weapon that has the broad arc property–meaning that it can target ships in the port or starboard arcs with a -2 penalty. He wishes to Snap Shoot the broad arc weapon at the ship in the port arc with a cumulative penalty of -4 (-2 for firing outside the weapon’s normal arc and -2 for the fact that it is a Snap Shot). This seems like a reasonable request to me, but do the rules preclude it? If they do, then had the pilot declared this intention before the other gunners rolled, would he have been able to do it within the rules?

dnd 5e – Do named actions in monster statblocks use the Attack action?

This question is inspired by the following and stems from wondering whether the Steel Defender’s “Force-Empowered Rend” action involves taking the Attack action:


Take the Lich for example, It has an action titled “Paralyzing Touch”; does this involve the Attack action? Similarly, the Ogre has the “Greatclub” and “Javelin” actions; do these involve the Attack action? How does one know if something listed under “Actions” in a monster’s statblock involves taking the Attack action or not?

This matters for various features that key off of taking the Attack action while somebody is polymorphed, shapechanged, Wild Shaped, or by some other means has become one of these creatures while maintaining their class features such as Extra Attack or the Monk’s Flurry of Blows.

Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn.

Immediately after you take the Attack action on your turn, you can spend 1 ki point to make two unarmed strikes as a bonus action.


Note that this question is different from my previous question:

Does using an Owl’s “Talons” action while Wild Shaped count as taking the Attack action?

Primarily because the question I asked previously was bad. It was asking about an action that could effectively be accomplished through unarmed strikes and was not asking about things like the Lich’s Paralyzing Touch and as such, the answers addressed that flaw in the question. This is, hopefully, a less flawed question that actually manages to ask what I was trying to ask originally.

c# – Engineering issue with database action argument and return types

I have an issue, which I dont know how to solve better, because my current approach seems sloppy.

I will try to explain my issue as well as I can. (It is WPF application)

Since I am using entity framework, I want to force for every database action to have open transaction. I do force that by passing DatabaseAction class to my services:

public class DatabaseAction<T> where T : class
{
    public DatabaseAction(T value, eWMSContext ctx)
    {
        Value = value;
        Ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
        if (ctx.Database.CurrentTransaction is null)
        {
            throw new Exception("Transaction is mandatory for database action!");
        }

        if (value is IEnumerable<object> enumerable)
        {
            foreach (var val in enumerable.ToList())
            {
                Ctx.Attach(Value);
            }
        }
        else
        {
            Ctx.Attach(Value);
        }
    }

    public T Value { get; set; }
    public eWMSContext Ctx { get; set; }
}

And for return types I am using interfaces:

public interface IActionResult<T>
{
    string Message { get; }
    T Value { get; }
}

public interface IErrResult
{
    string Message { get; }
}

And their implementations:

public class ErrResult<T> : IActionResult<T>, IErrResult
{
    public ErrResult(T value, string message = null)
    {
        if (value is null)
        {
            throw new ArgumentNullException(nameof(value));
        }

        Value = value;
        Message = message ?? string.Empty;
    }

    public T Value { get; private set; }
    public string Message { get; private set; }
}

public class OkResult<T> : IActionResult<T>
{
    public OkResult(T value, string message = null)
    {
        if (value is null)
        {
            throw new ArgumentNullException(nameof(value));
        }

        Value = value;
        Message = message ?? string.Empty;
    }

    public T Value { get; private set; }
    public string Message { get; private set; }
}

And with all that in place the implementation looks like this abomination (desktopNotificationManager is there just to show what the issue is to user in a nice way)

            foreach (var jobLineAction in jobLinesSourceCache.Items.Select(jl => new DatabaseAction<TJobLines>(jl, ctx)))
            {
                if (await jobLinesService.SetDestinationInventoryAsync(jobLineAction) is IErrResult errSetDestination)
                {
                    await desktopNotificationManager.NotifyErrorAsync(errSetDestination);
                    return;
                }
                if (await jobLinesService.SetStartInventoryAsync(jobLineAction) is IErrResult errSetStart)
                {
                    await desktopNotificationManager.NotifyErrorAsync(errSetStart);
                    return;
                }
            }

I dont particullary like the if statements. Also I am not sure if I am even on right path. Is there any way you would improve it? Or do it any other way?

I have never bothered before with exception handling, MVVM, nor unit tests, but I am learning that right now and I dont really want to cycle myself into bad practices.

I will be more than happy for any resource, idea, or explanation. Just cant find anything on google myself for my use case.

EDIT: I got a downvote. I would love to know what is wrong with this question. I am not here to bother anyone