Notifications
Clear all

[Closed] copy paste new script, not working?

If I have a downloaded script loaded on my toolbar and I right click the button and edit that script, then copy all and create a new script and paste everything in that, when I run evaluate all nothing happens?

Also if I save out the pasted script and load it up in the toolbar it still doesnt work??

Can anybody tell me why this is?

7 Replies

Post the new script, so we can find where the error is.

–Create by ArtLy http://forums.cgsociety.org/artly2000@yandex.r u” data-bbcode=”true”>artly2000@yandex.ru or http://forums.cgsociety.org/artly3d@mail.r u” data-bbcode=”true”>artly3d@mail.ru
–Country Russia Federation
–City Vladivostok
–Data 18.09.2007
–====================================================================================
macroScript AddTransPoly
ButtonText:“AddTransPoly”
Category:“ArtLy”
Tooltip:“Add TransEditPoly to target object (as Editable poly)”
Icon:#(“Max_Edit_Modifiers”,4)
(–script
–====================================================================================
rollout Conformm “AddTransPoly” width:144 height:154
(–roll
pickbutton source “Source” pos:[16,22] width:112 height:25 toolTip:“Select Transforated Object as (Editable Poly)”
pickbutton target “Target” pos:[16,47] width:112 height:25 toolTip:“Pick Target Object as (Editable Poly)”
GroupBox but ” Select OBJ ” pos:[8,8] width:128 height:72
button transObj “Transform” pos:[16,84] width:112 height:23 toolTip:“Add (Edit Poly) Transformation(Form) in Target object”
label blubber6 “http://forums.cgsociety.org/artly2000@yandex.r u” data-bbcode=”true”>artly2000@yandex.ru”

global VertsSour = #()
global VertsTarg = #()
local s, t, test1, test2

on source picked obj do
(
global Sobject = obj
source.text = obj.name
s = 1
)
on target picked targ do
(
global Tobject = targ
target.text = targ.name
t = 1
)
on transObj pressed do
(–on
if ((s == 1) and (t == 1)) then
(–Obj – Links
test1 = Sobject.numVerts
test2 = Tobject.numVerts
if (test1 == test2) then
(–math
in coordsys local
(–ss
select Tobject
modPanel.addModToSelection (Edit_Poly ()) ui:on
subobjectLevel = 1
edPolyMod = Tobject.modifiers[#Edit_Poly]
for i = 1 to Sobject.numVerts do
(
VertsSour[i] = polyop.getVert Sobject i
VertsTarg[i] = polyop.getVert Tobject i
)

max modify mode
modPanel.setCurrentObject edPolyMod
edPolyMod.SetEPolySelLevel #Vertex
for s = 1 to Sobject.numVerts do
(
edPolyMod.SetOperation #Transform
edPolyMod.SetSelection #Vertex #{}
edPolyMod.Select #Vertex #{s}
–xxxxxxxxxxxxxxx
mb = VertsSour[s].x
ma = VertsTarg[s].x
if (ma > mb) then
c = mb – ma
if (ma < mb) then
c = -ma + mb
if (ma == mb) then
c = 0
cx = c
–YYYYYYYYYYYYYYY
mb = VertsSour[s].y
ma = VertsTarg[s].y
if (ma > mb) then
c = -ma + mb
if (ma < mb) then
c = mb – ma
if (ma == mb) then
c = 0
cy = c
–ZZZZZZZZZZZZZZ
mb = VertsSour[s].z
ma = VertsTarg[s].z
if (ma > mb) then
c = mb – ma
if (ma < mb) then
c = -ma + mb
if (ma == mb) then
c = 0
cz = c
———OUT———-
–TR = VertsSour[s] – VertsTarg[s]
edPolyMod.MoveSelection [cx, cy, cz]
edPolyMod.Commit ()
)
)–ss
subobjectLevel = 0
update Tobject
)–math
else
(
messagebox “No Original Object (Vertex problem)”
title:“ERROR !!!”
)
)–Obj – Links
else
(
messagebox “Select Objects PLEASE”
title:“No Correctly USED !!!”
)
)–on
)–roll
createdialog Conformm
)–script

that’s pretty much what I paste into the new script. It runs fine from the downloaded and installed version

There is a difference between a maxscript and a macroscript. You can’t run a macroscript as a maxscript.

The macroscript has an additional header to say what category it goes into and to handle things like it being a button and being clicked/rightclicked on…

Should work by running this instead.

rollout Conformm "AddTransPoly" width:144 height:154
 (--roll
  pickbutton source "Source" pos:[16,22] width:112 height:25 toolTip:"Select Transforated Object as (Editable Poly)"
  pickbutton target "Target" pos:[16,47] width:112 height:25 toolTip:"Pick Target Object as (Editable Poly)"
  GroupBox but "          Select OBJ         " pos:[8,8] width:128 height:72
  button transObj "Transform" pos:[16,84] width:112 height:23 toolTip:"Add (Edit Poly) Transformation(Form) in Target object"
  label blubber6 "artly2000@yandex.ru"
 
 global VertsSour = #()
 global VertsTarg = #()
 local s, t, test1, test2
 
  on source picked obj do
  (
   global Sobject = obj
   source.text = obj.name
   s = 1
  )
  on target picked targ do
  (
   global Tobject = targ
   target.text = targ.name
   t = 1
  )
  on transObj pressed do
  (--on
  if ((s == 1) and (t == 1)) then
  (--Obj - Links
  test1 = Sobject.numVerts
  test2 = Tobject.numVerts
  if (test1 == test2) then
  (--math
  in coordsys local
  (--ss
   select Tobject
   modPanel.addModToSelection (Edit_Poly ()) ui:on
   subobjectLevel = 1
   edPolyMod = Tobject.modifiers[#Edit_Poly]
   for i = 1 to Sobject.numVerts do
   (
   VertsSour[i] = polyop.getVert Sobject i
   VertsTarg[i] = polyop.getVert Tobject i
   )
   
   max modify mode
   modPanel.setCurrentObject edPolyMod
   edPolyMod.SetEPolySelLevel #Vertex
   for s = 1 to Sobject.numVerts do
   (
   edPolyMod.SetOperation #Transform
   edPolyMod.SetSelection #Vertex #{}
   edPolyMod.Select #Vertex #{s}
   --xxxxxxxxxxxxxxx
   mb = VertsSour[s].x
   ma = VertsTarg[s].x
   if (ma > mb) then
   c = mb - ma
   if (ma < mb) then
   c = -ma + mb
   if (ma == mb) then
   c = 0
   cx = c
   --YYYYYYYYYYYYYYY
   mb = VertsSour[s].y
   ma = VertsTarg[s].y
   if (ma > mb) then
   c = -ma + mb
   if (ma < mb) then
   c = mb - ma
   if (ma == mb) then
   c = 0
   cy = c
   --ZZZZZZZZZZZZZZ
   mb = VertsSour[s].z
   ma = VertsTarg[s].z
   if (ma > mb) then
   c = mb - ma
   if (ma < mb) then
   c = -ma + mb
   if (ma == mb) then
   c = 0
   cz = c
   ---------OUT----------
   --TR = VertsSour[s] - VertsTarg[s]
   edPolyMod.MoveSelection [cx, cy, cz]
   edPolyMod.Commit ()
   )
  )--ss
  subobjectLevel = 0
  update Tobject
  )--math
  else
  (
  messagebox "No Original Object (Vertex problem)" \
  title:"ERROR !!!"
  )
  )--Obj - Links
  else
  (
  messagebox "Select Objects PLEASE" \
  title:"No Correctly USED !!!"
  )
  )--on
  )--roll
 createdialog Conformm 

Ace! Thanks for clearing that up Dave Will try this out.

Could you also point out what you changed in the script?

In this case it was just removing the top bit and a ‘)’ at the bottom, compare yourself.

ok, cheers Dave