CGTalk > Software Specific Forums > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-22-2011, 11:37 AM   #1
splinterD
Frequenter
portfolio
daniel dulitzky
3d generalist and concept artist
miami, USA
 
Join Date: Feb 2005
Posts: 160
image button switch image?

hi guys
i recently tried this cool tut : click
and was very pleased
now i want to switch the image displayed in the button by another factor to a specific image
in the same file

lets say something like this :

on (or) if "something something" do (or) then
(
btn_test.images = (the spcific one i want lets say 2)
)

its not working very well right now and i cant figure it out

would really appreciate it if you guys can help

thanks !!
 
Old 07-22-2011, 12:22 PM   #2
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,826
First of all, that tutorial example is not very efficient for reasons noted in this thread:
http://forums.cgsociety.org/showthr...p?f=98&t=993295

Secondly, you just need to redefine the .images property of the button to reflect the new indices you want. Can you post a sample of the code that is not working for you?
 
Old 07-22-2011, 12:55 PM   #3
splinterD
Frequenter
portfolio
daniel dulitzky
3d generalist and concept artist
miami, USA
 
Join Date: Feb 2005
Posts: 160
thanks rotem

thanks rotem so this is what i have right now
the button is defined like this:
button btn498 "" pos:[417,422] width:10 height:10 images:#("FDtest_16i.bmp", undefined, 8, 1, 4, 1, 1) border:false

and what im trying is :
on btn498 pressed do
btn498.images = ("FDtest_16i.bmp",8, 2, 4, 1, 1)

im getting:
"
-- Error occurred in anonymous codeblock; filename: D:\volt\scripts\temp\tracking to face rig Beta 0.3.mcr; position: 8395; line: 238
-- Syntax error: at ),, expected <factor>
-- In line: btn498.images = ("FDtest_16i.bmp",8
"
 
Old 07-22-2011, 01:06 PM   #4
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,177
Send a message via ICQ to denisT
Quote:
Originally Posted by splinterD
... and what im trying is :
on btn498 pressed do
btn498.images = #("FDtest_16i.bmp", undefined, 8, 2, 4, 1, 1)

im getting:
"
-- Error occurred in anonymous codeblock; filename: D:\volt\scripts\temp\tracking to face rig Beta 0.3.mcr; position: 8395; line: 238
-- Syntax error: at ),, expected <factor>
-- In line: btn498.images = ("FDtest_16i.bmp",8
"


the couple things were missed
 
Old 07-22-2011, 01:16 PM   #5
splinterD
Frequenter
portfolio
daniel dulitzky
3d generalist and concept artist
miami, USA
 
Join Date: Feb 2005
Posts: 160
so simple

so simple...
thanks denis , i guess ill go put a bag over my head now...
is there a fast way to explain y it didn't work ?
i get that there were missing those 2 things but ... y ?
thanks again!
 
Old 07-22-2011, 02:03 PM   #6
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,826
the .images property expects a value of type array. And not any array, an array of this format:
#(bitmap,bitmap,int,int,int,int,int)

you were supplying it with this value:
(bitmap,int,int,int,int,int)

which is not even an array.
 
Old 07-22-2011, 02:05 PM   #7
splinterD
Frequenter
portfolio
daniel dulitzky
3d generalist and concept artist
miami, USA
 
Join Date: Feb 2005
Posts: 160
ok

ok but is it the "right" or "officiant" way of using bitmaps in buttons
or dose it load the bitmap for each button every time like in the thread you gave me earlier ?
 
Old 07-22-2011, 02:34 PM   #8
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,826
If you supply it with a filename value like in your example, then it will load it each time as far as I can tell.

If you supply it with an already loaded bitmap value, it will not need to reload it each time and will run faster.

i.e.:
mybitmap = openBitmap "C:\\mybmp.bmp"
mybutton.images = #(myBitmap,undefined,4,1,1,2,2)

Both methods will work. If you have many buttons, the latter method's efficiency will probably be noticable.
 
Old 07-22-2011, 07:00 PM   #9
splinterD
Frequenter
portfolio
daniel dulitzky
3d generalist and concept artist
miami, USA
 
Join Date: Feb 2005
Posts: 160
sweet

sweet thanks again
 
Old 07-22-2011, 07:00 PM   #10
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:07 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.