permGroup() issues with trigger Mudlet 2.1

Share your scripts and packages with other Mudlet users.
Post Reply
hex337
Posts: 4
Joined: Mon Nov 25, 2013 12:42 am

permGroup() issues with trigger Mudlet 2.1

Post by hex337 »

I have the following code in a script:
Code: [show] | [select all] lua
  if exists("AlexK", "trigger") == 0 then
    permGroup("AlexK", "trigger")
  end

  if exists("Sailing", "trigger") == 0 then
    permRegexTrigger("Sailing", "AlexK", {"sails ([a-z]+), you see..."}, [[Sailing.handleNextMove()]])
  end
The idea is simple. Create a group if one doesn't exist, and then put a trigger in it. The problem is that the permGroup() call doesn't create a group called "AlexK", just a trigger with an id, and then the permRegexTrigger call doesn't do anything because there is no "AlexK" group to put it in.

I tried to figure out what the solution is, since there seem to be a few mentions of it on the forums, but its still not working for me.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: permGroup() issues with trigger Mudlet 2.1

Post by SlySven »

Using the source, Luke....

I do not see a permGroup(...) function coded into the Mudlet "built-in" Lua sub-system. Where are you getting permGroup(...) from?

Um, according to the Wiki there is a:
permGroup
permGroup(name, itemtype)


Creates a new group of a given type at the root level (not nested in any other groups). This group will persist through Mudlet restarts.

Parameters
  • name:
    The name of the new group you want to create.
  • itemtype:
    The name of the timer, trigger, or alias.
:idea: Note: Added to Mudlet in the 2.0 final release.
Strange, where is it...? :?

EDIT: Ah, found it! Vadim put it into the Other.lua file, one of the Lua files that form the set that we include in the Mudlet package - it was added on 2011-04-25 in commit-18cbfbc5. itemtype seems to be "timer", "trigger" or "alias" and then this function calls one of:

Code: Select all

permTimer(name, "", 0, "")
permSubstringTrigger(name, "", {""}, "")
permAlias(name, "", "", "")
as appropriate.[/color]

The absence of a parent should create a new group IIRC, I'll have to take a closer look at this - I wonder whether there may be a capitalisation issue ("Trigger" not "trigger")...?

Post Reply