Home Technical Talk

MAXScript - passing a string without quotation marks?

polycounter lvl 13
Offline / Send Message
Wesley polycounter lvl 13
Hey guys.

I'm trying to have an automated wire parameter and am getting caught up in one of the arguments.

Here's the code:
paramWire.connect $.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float] (pickMesh.object).modifiers[#Morpher][(morphNameResult)](endString)

Which translates into:
paramWire.connect $TeapotTestCircleController.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float] $Teapot001.modifiers[#Morpher][#_1__Teapot002___Target_Available] "Limited_Controller__Bezier_Float*20"

Or rather it WOULD, if morphNameResult didn't print as "#_1__Teapot002___Target_Available".

Any idea how to pass a string without quotation marks?

I've tried doing it another method, by grabbing the name from obj.morpher[1].name and just passing that, but it does say it wants a string. If I use obj.morpher[1].name as string inside the argument it then just gives me the same error.

Super stuck here.

Replies

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    i was just doing this sort of thing today as it happens ...

    check the string parser section in the maxscript help - you'll be able to chop those off fairly easily
  • Wesley
    Options
    Offline / Send Message
    Wesley polycounter lvl 13
    Okay after digging I've found the "trimleft". But the problem I'm running into it how to define the quotation mark as being the thing I want to trim.
    trimLeft stringy """
    

    Isn't getting my anywhere, not that I thought it would.
  • Wesley
    Options
    Offline / Send Message
    Wesley polycounter lvl 13
    Okay, if I use "\"" it accepts it... but it still spits out the string with quotation marks in the listener and I'm still getting the same error.
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    a quick test ...
    a = WM3_MC_GetName $.morpher 0
    print a
    print a.count
    
    the channel that's pointing at is called Sphere002
    the output in the listener is as follows
    "Sphere002"
    9
    
    
    in this case it's reporting the right length - ie. it'd be 11 if the quotes were included. If i iterate through the string and print the results out character by character the quotes aren't included either.

    looks like the listener quotes strings by itself to me - given the amount of scripting Ive been doing lately you'd think I'd have known that.
  • Norman3D
    Options
    Offline / Send Message
    Norman3D polycounter lvl 14
    Strings are always printed with quotes. Unless you use "format" to print them to the listener.
    Number "9" is printed without quotes since it's an integer.
    print 9
    print (9 as string)
    

    will be printed as
    9
    "9"
    

    I haven't looked into your code, because I don't have much time. But my guess is you are using a string when you should be using something else.
  • Wesley
    Options
    Offline / Send Message
    Wesley polycounter lvl 13
    I've tried passing it off as a name and just directly referencing the morph channel result, but it doesn't work either.

    Edit: Okay, after being super confused for a good while now I think I've cracked it.

    For some random ass reason declaring an integer of the morph channel (instead of the name) as a global variable and passing that works.
Sign In or Register to comment.