[Closed] stringTab limitation?
I’m using a stringTab to store some settings and the array itself contains 26 items and it’s return and error. I know the bug comes from max’s arrays ending the array at after 20 with … and I’m guessing that is where the bug is.
MAXScript Scripted Plugin Handler Exception
---------------------------
-- Syntax error: at .., expected <factor>
-- In line: #("", 6, 6, 0, 12, 4, 0, 10.0, 0, 10.0, 0.0, 0.0, 0.0, 0, 0.0, 10.0, 0.0, 0.0, 0.0, 1, ...
---------------------------
I’m running this function to read in the data from the string tab…
fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
(
local tmpArr = #()
if stg.count >= 1 do
(
for p = 1 to stg.count do
(
part = execute (substring stg[p] 1 (stg[p].count))
append tmpArr part
)
)
tmpArr
)
It someone needs me to post a sample script to test with let me know.
Thank you guys.
Here is a test script for anyone who may have a solution to this problem.
plugin simpleObject StringBugs
name:"String Bugs"
category:"Standard Primitives"
classID:#(0x503dde09, 0x1cd52e63)
(
parameters main rollout:main
(
sectionsData type:#stringTab tabSize:0 tabSizeVariable:true
sectionCounter type:#integer default:0 ui:uiCounter
on sectionsData tabChanged change tabIndex tabCount do
(
this.UpdateUI()
)
)
rollout main "Sections"
(
button uiNewSection "New" height:24 width:51 align:#left offset:[-9,0]
label uiCount "Count:" across:2
spinner uiCounter "" type:#integer fieldwidth:50 enabled:false
on uiNewSection pressed do
(
local newSection = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) as string
append sectionsData newSection
)
)
fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
(
local tmpArr = #()
if stg.count >= 1 do
(
for p = 1 to stg.count do
(
part = execute (substring stg[p] 1 (stg[p].count))
append tmpArr part
)
)
tmpArr
)
fn UpdateUI =
(
sectionCounter = sectionsData.count
)
on buildMesh do
(
for s in sectionsData do
(
local sectionsArr = getArrayFromString sectionsData
print sectionsArr
)
)
tool create
(
local first_pos
on mousePoint click do case click of
(
1: #stop
)
)
)
clearlistener()
m = StringBugs()
select m
Use PrintAllElements.
To clarify, use PrintAllElements when converting to string. Not when converting back to array.
In case anyone ever comes across this. Here is a solution.
plugin simpleObject StringBugs
name:"String Bugs"
category:"Standard Primitives"
classID:#(0x503dde09, 0x1cd52e63)
(
parameters main rollout:main
(
sectionsData type:#stringTab tabSize:0 tabSizeVariable:true
sectionCounter type:#integer default:0 ui:uiCounter
on sectionsData tabChanged change tabIndex tabCount do
(
this.UpdateUI()
)
)
rollout main "Sections"
(
button uiNewSection "New" height:24 width:51 align:#left offset:[-9,0]
label uiCount "Count:" across:2
spinner uiCounter "" type:#integer fieldwidth:50 enabled:false
on uiNewSection pressed do
(
local newSection = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
--//Recreated array with supplied times (bug:array limits to 20 then adds "...)"
str = "#("
for n in newSection do str += (n as string) + ", "
str = substring str 1 (str.count - 2) + ")" --remove last comma
append sectionsData str
)
)
fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
(
local tmpArr = #()
if stg.count >= 1 do
(
for p = 1 to stg.count do
(
part = execute (substring stg[p] 1 (stg[p].count))
append tmpArr part
)
)
tmpArr
)
fn UpdateUI =
(
sectionCounter = sectionsData.count
)
on buildMesh do
(
for s in sectionsData do
(
local sectionsArr = getArrayFromString sectionsData
for s in sectionsArr do
(
print s
)
)
)
tool create
(
local first_pos
on mousePoint click do case click of
(
1: #stop
)
)
)
clearlistener()
m = StringBugs()
select m
Your first posts suggests you have mixed data, but you may be able to just use #floatTab or #intTab. What I need in Max is a TabTab.