Skip to main content
Recent Posts
73
User Tools / Re: Percussion splitter
Last post by Flurmy -
Quote
In the new beta, the |Text:*| property and User object properties are now stored as strings (replaces the nwcOptText object).

In the current general release, text properties use a nwcOptText class for storage. This is a heavy operation that requires an additional allocated table just to store the encoded string.
In this same release, user object properties are all stored as raw, encoded strings. This creates a complicated approach to handling the text properties.

In the new beta, all of these text properties are maintained as simple decoded strings. All simple strings are passed through an encoding filter before writing them back into a nwctxt file stream, which strives to make scripting changes to these properties much simpler.
It does create an issue for current tools.

As it currently stands, changes will be required in tool code when accessing these text properties. Perhaps the easiest way to handle this is by two utility functions:
Code: [Select · Download]
local function GetTextProp(item,lbl)
  local t = item.Opts[lbl]
  return (t and t.Text) and t.Text or t
end
Code: [Select · Download]
local function SetTextProp(item,lbl,txt)
  item:Provide(lbl,'')

  if item.Opts[lbl].Text then
    item.Opts[lbl].Text = txt
  else
    item.Opts[lbl] = txt
  end
end
75
User Tools / Re: Percussion splitter
Last post by Flurmy -
A-ha!
I seem to remember (quite surprising for me!  ;D ) that a small change about this was made in the lua libraries in NWC 2.8 Beta 1 (the one I'm using).
Which version of NWC are you using?
77
User Tools / Re: Percussion splitter
Last post by Flurmy -
But I don't know why the behaviour is different on my side.
So do I.

But:
  • In your snippet the staff name is "perc", in your dump is "perc." but, even after changing it, I found no difference in the result.
  • Using your dump routine I get:
    Code: [Select · Download]
    { 
       ["Name"] = perc.,
       ["Group"] = Standard,
    }

Quite different! Why?
78
User Tools / Re: Percussion splitter
Last post by yukulele -
After a few debug time I realize that `Item.Opts` have this structure for me:

Code: [Select · Download]
{
  ["Group"] = { ["Text"] = Standard, },
  ["LabelAbbr"] = "abbr",
  ["Label"] = { ["Text"] = label, },
  ["Name"] = { ["Text"] = perc, },
}

So I now use:
Code: (lua) [Select · Download]
local Name = Item.Opts.Name.Text or Item.Opts.Name
local PercStaffNumber = string.match(Name, PercStaffName.."(%d+)")

But I don't know why the behaviour is different on my side.

my debug code:
Spoiler (click to show/hide)
79
User Tools / Re: Percussion splitter
Last post by Flurmy -
I don't.
Code: (nwc) [Select · Download]
!NoteWorthyComposer(2.751)
|Editor|ActiveStaff:1|CaretIndex:1|CaretPos:0
|SongInfo|Title:"test perc"|Author:"<Name>"|Lyricist:""|Copyright1:"Copyright © 2026 <Name>"|Copyright2:"All Rights Reserved"
|PgSetup|StaffSize:16|Zoom:4|TitlePage:Y|JustifyVertically:Y|PrintSystemSepMark:N|ExtendLastSystem:N|DurationPadding:Y|PageNumbers:0|StaffLabels:None|BarNumbers:None|StartingBar:1
|Font|Style:StaffItalic|Typeface:"Times New Roman"|Size:10|Bold:Y|Italic:Y|CharSet:0
|Font|Style:StaffBold|Typeface:"Times New Roman"|Size:8|Bold:Y|Italic:N|CharSet:0
|Font|Style:StaffLyric|Typeface:"Times New Roman"|Size:7.2|Bold:N|Italic:N|CharSet:0
|Font|Style:PageTitleText|Typeface:"Times New Roman"|Size:24|Bold:Y|Italic:N|CharSet:0
|Font|Style:PageText|Typeface:"Times New Roman"|Size:12|Bold:N|Italic:N|CharSet:0
|Font|Style:PageSmallText|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User1|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User2|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User3|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User4|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User5|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|Font|Style:User6|Typeface:"Times New Roman"|Size:8|Bold:N|Italic:N|CharSet:0
|PgMargins|Left:1.27|Top:1.27|Right:1.27|Bottom:1.27|Mirror:N
|AddStaff|Name:"perc"|Group:"Standard"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:12|BoundaryBottom:12|Lines:5|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:10
|StaffInstrument|Trans:0|DynVel:10,30,45,60,75,92,108,127
|Clef|Type:Percussion
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:-2
|Note|Dur:4th|Pos:-3
|AddStaff|Name:"Perc. staff 1"|Label:"Toms"|Group:"Percussions"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:12|BoundaryBottom:12|Lines:1|WithNextStaff:Bracket,ConnectBars|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:10
|StaffInstrument|Trans:-5|DynVel:10,30,45,60,75,92,108,127
|Clef|Type:Percussion
|Key|Signature:Bb|Tonic:F|Visibility:Never
|Note|Dur:4th|Pos:3y
|Note|Dur:4th|Pos:2y
|Note|Dur:4th|Pos:1y
|Note|Dur:4th|Pos:0y
!NoteWorthyComposer-End
80
User Tools / Re: Percussion splitter
Last post by yukulele -
Oups 😅 Sorry Flurmy, I misread the end of the first message as a signature.

I don't have any staves that start with "Perc. staff ".

Here is a minimal example for which I get an error:
Code: (nwc) [Select · Download]
!NoteWorthyComposer(2.751)
|SongInfo|Title:"test perc"
|AddStaff|Name:"perc"|Group:"Standard"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:12|BoundaryBottom:12|Lines:5|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:10
|Clef|Type:Percussion
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:-2
|Note|Dur:4th|Pos:-3
!NoteWorthyComposer-End