Jump to content
  • 0

bindatcmd help needed!


Succubusty

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

Okay here's my script.

 

-    script    no_storage    -1,{
OnInit:
    bindatcmd "storage",strnpcinfo(0)+"::OnAtCommand";
    end;
OnAtCommand:
    if((strcharinfo(3) == "turbo_n_1") && getgroupid() < 3)
        message strcharinfo(0),"You can't use @storage during this event.";
    else
        atcommand "@storage";
    end;
}

 

What I'm trying to do is... I want to disable the usage of @storage on the map turbo_n_1 for any non-GMs (below group id 3). With my script right now, it works fine when a regular player (group id 0) is in the map. It displays the text & doesn't allow them to use the command. However, everywhere else, if you try to use the command (GM or not), then you get the error "@storage failed". Any ideas where I went wrong?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Well, ill give you a hint: You bind a new "event" to the name of an already existing one, basicaly overriding the usual code of @storage with your script "no_storage::OnAtCommand". So guess what "atcommand "@storage";" calls now? :D

Upon execution of the atcommand, the user invoke the NPC event label first. But you can call the initial atcommand with atcommand script npc.

 

 

 

Use

openstorage;

instead of

atcommand "@storage";

to avoid this error.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   9
  • Joined:  09/22/12
  • Last Seen:  

Well, ill give you a hint: You bind a new "event" to the name of an already existing one, basicaly overriding the usual code of @storage with your script "no_storage::OnAtCommand". So guess what "atcommand "@storage";" calls now? :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

For some reason (I haven't looked into it yet) @storage fails for me if binded to a script. Try 'openstorage' instead?

@Reynard: 'atcommand' always calls the original command.

Edit: Beaten. :<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   9
  • Joined:  09/22/12
  • Last Seen:  

Damn, well then ive learned something new. Never tried to call an atcommand inside a bindatcmd NPC event label.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  182
  • Reputation:   22
  • Joined:  12/30/12
  • Last Seen:  

Might wanna try this?

 

 

    set .allowgmlvl, 40; //REQUIRED GM
    .....
    .....
    getmapxy (.@map$, .@x, .@y, 0); 
    if(.@map$ == "turbo_n_1")
    {
      if(getgmlevel() < .allowgmlvl) goto STORAGEFAILED;
      else {
      //OPEN STORAGE
      }
      .....
      .....
 
      STORAGEFAILED:
 
   }


Might wanna try this?

 

 

    set .allowgmlvl, 40; //REQUIRED GM
    .....
    .....
    getmapxy (.@map$, .@x, .@y, 0); 
    if(.@map$ == "turbo_n_1")
    {
      if(getgmlevel() < .allowgmlvl) goto STORAGEFAILED;
      else {
      //OPEN STORAGE
      }
      .....
      .....
 
      STORAGEFAILED:
 
   }

 

Here's the script... I think it's working

 

-    script    no_command    -1,{
OnInit:
        bindatcmd "storage",strnpcinfo(3)+"::OnStore";
    end;
 
OnStore:
   set .allowgmlvl, 40; //REQUIRED GM
   getmapxy (.@map$, .@x, .@y, 0); 
    if(.@map$ == "turbo_n_1")
    {
      if(getgmlevel() < .allowgmlvl) dispbottom "You can't use @storage in this map.";
      else openstorage;
    }
    else if (.@map$ != "turbo_n_1") openstorage;
 
}
Edited by paopao
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

Well, ill give you a hint: You bind a new "event" to the name of an already existing one, basicaly overriding the usual code of @storage with your script "no_storage::OnAtCommand". So guess what "atcommand "@storage";" calls now? :D

Upon execution of the atcommand, the user invoke the NPC event label first. But you can call the initial atcommand with atcommand script npc.

 

 

 

Use

openstorage;

instead of

atcommand "@storage";

to avoid this error.

 

Thank you C: This solved my problem. It would be my luck that @storage would be the one atcommand that works funny inside bindatcmd. I was mainly basing my usage off of this thread, so I was confused as to why it wasn't working.

Edited by Succubusty
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...