Jump to content
  • 0

bindatcmd help needed!


Question

Posted

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?

6 answers to this question

Recommended Posts

Posted

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
Posted

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

Posted

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. :<

Posted (edited)

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
Posted (edited)

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...