A little help please! bindatcmd>getgroupid>menu

Nerual

New member
Messages
5
Points
0
I'm trying to to use bindatcmd to open a menu.. not sure what I'm doing wrong I always get "npc_event: event not found"  error.

Code:
-	script	gmmenu	-1,{

OnInit:

	bindatcmd "gmmenu",strnpcinfo(3)+"::GM_Menu";
	end;

GM_Menu:

	if (getgroupid() >= 60){

		set .@menu$,"menu1:menu2";

		switch(select(.@menu$)){

			case 1:	
			    mes "menu1";
			    close;

			case 2:
			    mes "menu2";
			    close;
			}
	}
}
 
Last edited by a moderator:
-    script    gmmenu    -1,{
 
OnAtGM_Menu:
 
    if (getgmlevel() >= 60) {
 
        .@menu$ = "menu1:menu2";
 
        switch(select(.@menu$)){
 
            case 1:    
                mes "menu1";
                close;
 
            case 2:
                mes "menu2";
                close;
            }
    }
end;
OnInit:
 
    bindatcmd "gmmenu",strnpcinfo(0)+"::OnAtGM_Menu";
    end;
}


PS: Also had to name the menu "::OnAt(menuname)"

 
-    script    gmmenu    -1,{
 
OnAtGM_Menu:
 
    if (getgmlevel() >= 60) {
 
        .@menu$ = "menu1:menu2";
 
        switch(select(.@menu$)){
 
            case 1:    
                mes "menu1";
                close;
 
            case 2:
                mes "menu2";
                close;
            }
    }
end;
OnInit:
 
    bindatcmd "gmmenu",strnpcinfo(0)+"::OnAtGM_Menu";
    end;
}


PS: Also had to name the menu "::OnAt(menuname)"
I never knew ::OnAt was anything could you explain to me exactly what that means or is? I don't see any information on that (searching ::OnAt only shows this post I made) Maybe I'm just bad at searching? Now that I'm paying attention I also see "::On" being used on some other scripts. Sorry to be a pain but id rather not just copy and paste it and say fixed.
default_smile.png
(Also I never knew GM Ocean had a huge scripting guide pinned here... I've been learning via trial and error... and looking at other scripts.+ the Wiki I'll def be reading that. Sorry again thanks for your help. Also to you @
evilpuncker thanks! ~getgmlevel is deprecated so I just put getgroupid like my original script seems to work fine either way thanks~

 
Last edited by a moderator:
Never knew getgmlevel was deprecated.
default_ohmy.png


EDIT: Also I tested without "OnAt" I was wrong. It just needs "On" in order to be triggered. I had this problem awhile ago with instance scripts so I guess it applies to bindatcmd too.

 
Back
Top