1. Пользоваться форумом на планшетах и телефонах стало удобнее благодаря Tapatalk

Помогите разобраться со скриптом

Тема в разделе "MAXScript", создана пользователем DenGame, 14 май 2014.

Модераторы: Savin Denis
  1. DenGame

    DenGame Пользователь сайта

    С нами с:
    12.05.2014
    Сообщения:
    1
    Симпатии:
    0
    Баллы:
    2
    Доброго времени суток, помогите решить проблему со скриптом, пишу на 3ds Max 7 версии, если его запустить то сразу же выбивает ошибку
    [​IMG]
    Если нажать Evaluate All два раза то выдает такую ошибку
    и начинает работать так как надо до перезапуска Макса.
    Но когда я решил показать его другу (у друга установлен 3ds Max 2010) то у него вообще не запустился, и Evaluate All уже не помогал, вроде бы постоянно выдавал ошибку ту что на скрине. Пришлось установить Gmax на нем запустился так же как и на 7 версии Макса
    вот сам скрипт
    http://pastebin.com/uSzhD70T
    Чтото никак непойму как тут спойлер сделать?
    Код:
    
    
    rollout MainRollout "Importer" width:219 height:105
    (
    	button Import "Import Model" pos:[44,20] width:129 height:28
    	on Import pressed do 
    (
    		FName = undefined
    		FName = GetOpenFileName types:("All Files (*.*)|*.*| Vigilante8  (*.mod)|*.mod|")
    --		FName = "E:\DenGame\3dsmax7\scripts\game.raw"
    		if (FName != undefined) then
    	(
    			f = fopen FName "rb"
    			if (f != 0) then 
    						
    --f = fopen "D:\5388" "rb"
    clearlistener()
    
    Face_array=#()
    Vert_array=#()
    dr=0
    
    
    
    --UV_array=#()
    NumV=ReadLong f 
    OffsV=ReadLong f 
    
    NumMTA=ReadLong f 
    OffsMTA=ReadLong f 
    
    NumFaces=ReadLong f 
    OffsFaces=ReadLong f
    
    Scale=ReadShort f
    MTA2=ReadShort f 
    
    
    fseek f OffsV #seek_set
    
    --count=6
    print ("Vertices = " + NumV as string)
    print ("MTA = " + NumMTA  as string)
    print ("Faces = " + NumFaces  as string)
    print ("Scale = " + Scale  as string)
    print ("MTA2 = " + MTA2 as string + "   0x"+ bit.intAsHex(MTA2) as string)
    
    
    
    for x = 1 to NumV do
    (
    
    vx=readshort f 
    vy=readshort f 
    vz=readshort f 
    
    vbd=readshort f 
    
    
    
    --p4=readfloat f
    --p5=readfloat f
    --p6=readfloat f
    --tu=readfloat f
    --tv=readfloat f
    --p9=readshort f
    --p10=readshort f
    --p11=readshort f
    append Vert_array[vz,vx,vy]
    --append UV_array[tu,tv,0]
    )
    
    
    
    --count=4
    fn ReadFaces f =
    (
    HEADER = ReadLong f
    if ( HEADER == 0 ) then      -- 00000000
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 360677247 ) then      -- 7F7F7F15
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 159350655 ) then      -- 7F7F7F09
    	(	
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 92241791 ) then      -- 7F7F7F05
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 208685112 ) then      -- 3848700C
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 92307584 ) then      -- 80808005
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "80808005"
    	)
    else if ( HEADER == 67108864 ) then      -- 00000004
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 159416448 ) then      -- 80808009
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "80808009"
    		Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
    	)	
    else if ( HEADER == 139995915 ) then      -- 0B2B5808
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 134217728 ) then      -- 00000008
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 72887051 ) then      -- 0B2B5804
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 525041280 ) then      -- 807E4B1F
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 323714688 ) then      -- 807E4B13
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 226525312 ) then      -- 8080800D
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 72043339 ) then      -- 4B4B4B04
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 139152203 ) then      -- 4B4B4B08
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 494960768 ) then      -- 8080801D
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 68161552 ) then      -- 10101004
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 470880529 ) then      -- 1111111C
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 136585248 ) then      -- 20202408
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 138099516 ) then      -- 3C3B3B08
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 68688931 ) then      -- 231C1804
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 135796760 ) then      -- 18181808
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 18907168 ) then      -- 20802001
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 16810008 ) then      -- 18800001
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 25198720 ) then      -- 80808001
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 16809984 ) then      -- 00800001
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 218136576 ) then      -- 0080000D
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 19544192 ) then      -- 80382A01
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 220870784 ) then      -- 80382A0D
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 16777216 ) then      -- 00000001
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    	)
    else if ( HEADER == 203966022 ) then      -- 4646280C
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "4646280C"
    	)
    else if ( HEADER == 68558635 ) then      -- 2B1F1604
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "2B1F1604"
    	)
    else if ( HEADER == 135667499 ) then      -- 2B1F1608
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "2B1F1608"
    	)
    else if ( HEADER == 135862553 ) then      -- 19191908
    	(
    		fa=readshort f #unsigned+1
    		fb=readshort f #unsigned+1
    		fc=readshort f #unsigned+1
    		ta1=readlong f
    		ta1=readshort f	
    		append Face_array[fc,fb,fa]
    		print "19191908"
    	)
    )
    --print count
    fseek f OffsFaces #seek_set
    
    for x = 1 to NumFaces do
    (
    dr = dr+1
    print dr as string
    ReadFaces f
    print ""
    
    )
    --Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
    
    
    
    msh = mesh vertices:Vert_array faces:Face_array
    --msh.numTVerts = UV_array.count
    --buildTVFaces msh
    msh.name=FName
    
    
    
    --Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
    gc()
    fclose f
    print FName
    print "OK!"
    )
    )
    )
    CreateDialog  MainRollout
    
     
  2. Royal Ghost

    Royal Ghost Мастер

    С нами с:
    17.03.2001
    Сообщения:
    305
    Симпатии:
    41
    Баллы:
    214
    Код:
    (
    fn fn_test = 
    (
    print "test"	
    )
    
    rollout rollout_test "Test Rollout"
    (
    button btn_test "Button"	
    
    on btn_test pressed do
    (
    fn_test()	
    )
    )
    createdialog rollout_test
    )
    
    
    Функция не может находится внутри нажатия кнопки.
    http://pastebin.com/xT4pn1Lw
     
Модераторы: Savin Denis

Поделиться этой страницей