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

I don't see why this isn't working x.x - [solved]


Zamin
 Share

Recommended Posts

Hello,

This is what I did:

in Sub ScriptedNPC
```
Case 1
    Call CustomMenuClose(Index)
    Call CustomMenuShow(Index, "QuestExtra2", "\GUI\CUSTOM\QuestExtra\Menu.gif", 1)
    Call CustomMenuLabel(Index, 0, "Get a stick to advance to the next class!", 3, 3, 8, 0, 0, 190, 200)
    Call CustomMenuLabel(Index, 1, "I have stick!!", 3, 260, 8, 5, 0, 78, 15)
    Call CustomMenuLabel(Index, 2, "Close!", 150, 280, 8, 4, 0, 40, 15)
Exit Sub

```
In Sub MenuScripts
```
If Clicked_Index = 2 Then       
    Call CustomMenuClose(Index)
ElseIf Clicked_Index = 1 Then
    If CanTake(Index, 3, 1) = false Then
          PlayerMsg(Index, "You didn't get the item! Go buy it from the merchant!", RED)
    Else
          Call TakeItem(index, 3, 1)
          Call SetPlayerSprite(Index, 2)
          PlayerMsg(Index, "Thanks, here's your reward!", RED)
    EndIf
EndIf

```
I just can't figure what is wrong with this script. All I want to do it talk to the NPC, custom menu opens, if I click 'I have stick'. NPC checks, if so then it changes my sprite to '2'.

But when I click on the menu, it doesn't recognize my click. The yellow line does not appear indicating which index I am clicking.

Please let me know if I didn't something wrong in this code.

-Thanks in advance
Link to comment
Share on other sites

@Tylian!:

> ```
> Call PlayerMsg(Index, "Thanks, here's your reward!", RED)
>
> ```

OMG!!!!!!!!!!!!!!!!!!!!
I can't believe I messed that up. I could have at least looked at the above msg line, and a few dozen above that.

-Thanks xD

EDIT: OK, but it still doesn't recognize my click on the menu. :(
Link to comment
Share on other sites

@Snoop:

> you missed another Call 3-4 lines above that 1 aswell

This time I tried it before posting. lol.
Still doesn't recognizes my click. It seems that when I click, system doesn't enter the MenuScripts Sub at all. :(
Link to comment
Share on other sites

```
If Clicked_Index = 2 Then     
    Call CustomMenuClose(Index)
ElseIf Clicked_Index = 1 Then
    If CanTake(Index, 3, 1) = false Then
          Call PlayerMsg(Index, "You didn't get the item! Go buy it from the merchant!", RED)
    Else
          Call TakeItem(index, 3, 1)
          Call SetPlayerSprite(Index, 2)
          Call PlayerMsg(Index, "Thanks, here's your reward!", RED)
    EndIf
EndIf
```
Code wise it looks good i think, Make sure your takeitem sub is there and workin, the only thing im thinking is most functions give numbers are you sure that cantake uses true and false?

If anything can you show me the sub?
Link to comment
Share on other sites

oh ok well then i see no problem with the code then, is the scripts working? as in /testscripts. Also try this

```
If Clicked_Index = 1 Then     
    Call PlayerMsg(Index, "You clicked label 1", RED)
ElseIf Clicked_Index = 2 Then
    Call PlayerMsg(Index, "You clicked label 2", RED)
End If
Call CustomMenuClose(Index)
```
that should test to see if your labels are working also i noticed in the "endif" you forgot to separate them.
Link to comment
Share on other sites

```
If Clicked_Index = 2 Then     
    Call CustomMenuClose(Index)
ElseIf Clicked_Index = 1 Then
    If CanTake(Index, 3, 1) = false Then
          Call PlayerMsg(Index, "You didn't get the item! Go buy it from the merchant!", RED)
    Else
          Call TakeItem(index, 3, 1)
          Call SetPlayerSprite(Index, 2)
          Call PlayerMsg(Index, "Thanks, here's your reward!", RED)
    End If
End If
```
Link to comment
Share on other sites

@Owen:

> EndIf is End If (two words, bud)

OMG, no way. So that was the problem!! I checked. First I forgot to write 'Call' and now I forgot how to end if statements. xD

Can't get any noobish than this. lol
-Thanks to all for clearing the noobish mistakes.
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...