Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to script a click on a picture?


damian666
 Share

Recommended Posts

hi guys, this is my first time ever using sadscript, so please bear with me ok ^^

i have a scripted tile, and it opens up a custom menu, with 2 picture buttons.

1, choose, 2, close

so, how the hell am i supposed to script actions on those buttons?

all it does now is stating with picture was clicked in what menu.
i tried changing that line, in the close cmd, but then it closes on all pictures, and not only on the close button…  XD

any help would be welcome ^^

thanx in advance

Damian666
Link to comment
Share on other sites

Ok, so you have your scripted tile which opens up a menu, right? It SHOULD look SOMETHING like this, not exactly though ;).

```
Case 0
Call CustomMenuShow(Index, "Background 1", "\GUI\CUSTOM\Background.bmp", 1)
Call CustomMenuPicture(Index, 1, "\GUI\CUSTOM\Choose.bmp", 35, 176)
Call CustomMenuPicture(Index, 2, "\GUI\CUSTOM\Close.bmp", 363, 176)
```
Notice the "1" and the "2" in the CustomMenuPicture, those are very important as they identify what the picture IS, so Chooses is number 1, Close is number 2.

Next, you should have THIS under your Sub MenuScripts:

```
Case 1                                   
If Clicked_Index = 1 Then
            *Whatever happens when Choose is picked*)
        End If
        If Clicked_Index = 2 Then
            Call CustomMenuClose(Index)
        End If
```
And that's how you add scripted buttons =).
Link to comment
Share on other sites

whoa, that simple hee O.o

why the hell did i not think of that ^^

one more then, just hypothetical, if i create more custom menu's
the index number of the image goes up?

proberly yes huh?
because if i make more then one menu, icany be index 1, because that is used in another menu right?

or is there a way to further the difference, like with the cuctom menu name?

thanx alot anyway, you made it very clear for me, and my god, it WORKS :p

Damian666
Link to comment
Share on other sites

Actually, Squiddle, you'll want to sort like that anyway, or any time you click picture 1 or 2, no matter the menu, you'll get those effects.

I think this is the code:

```
Case 1                                    
    Select Case Menu_Title             
          Case "Background 1"                         
                        If Clicked_Index = 1 Then
              *Whatever happens when Choose is picked*)
          End If 
          If Clicked_Index = 2 Then
              Call CustomMenuClose(Index)
          End If
      End Select
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...