Kevinscape
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Kevinscape

Kevinscape Forums
 
HomePortalSearchLatest imagesRegisterLog in

 

 making a actionbutton do anything

Go down 
AuthorMessage
Kevin5475845
Admin
Admin
Kevin5475845


Number of posts : 443
Age : 31

Character sheet
HP:
making a actionbutton do anything Left_bar_bleue100/100making a actionbutton do anything Empty_bar_bleue  (100/100)

making a actionbutton do anything Empty
PostSubject: making a actionbutton do anything   making a actionbutton do anything Icon_minitimeThu Jul 05, 2007 8:35 pm

Purpose: to get actionbutton id's and making them work(works in interfaces too)

Difficulty: 1/10 depends on what you code for the button

Classes Modified: client.java

Step 1: ok lets say you wanted the button effect volume off to work making a actionbutton do anything 1_bmp14
so first we click on the button once then we look in serverconsole and you should see something like
making a actionbutton do anything 2_bmp16 ok now we got the id of that button lets move on to step to



Step 2: to make that button work search after case 185 like this
Code:
case 185:

and you should come to this one
Code:
case 185:              //clicking most buttons
and now scroll down untill you see this
Code:
switch(actionButtonId) {
after the { so must you add a case like this
Code:
case ACTIONBUTTONID:

so this case for that button will start now like this
Code:
case 3173:

so now we got our case ready so lets add stuff that will happen when you press that button

so start with adding
Code:
sendMessage("you just pressed the effect volume off button");

so it looks like
Code:
case 3173:
sendMessage("you just pressed the effect volume off button");

and that's it but wait if you compile you will get a error
so lets add this under the sendmessage
Code:
break;
so it looks like

Code:
case 3173:
sendMessage("you just pressed the effect volume off button");
break;

now your done save and compile and click the button and you should see something like this when you click it

making a actionbutton do anything 3_bmp11

remember cases are like if's

case : is same as a {

and break; is same as }

except it should be one of each unless you do another switch in that case

what you have learn'd(i hope): how to get action button id's, how to make them work
Back to top Go down
https://kevinscape.forumotion.net
 
making a actionbutton do anything
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Kevinscape :: Java :: Tutorials-
Jump to: