Bin4ry Posted October 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 782 Reputation: 82 Joined: 01/01/12 Last Seen: September 21, 2015 Share Posted October 17, 2012 This is out of my ability so I'd have to request support from here. What I'm trying to do is let bindatcmd ability to attach a temp string variable to let use in script. *bindatcmd "command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>}; Hmmm... here is a simple dummy script how would it supposed to work. - script dummy -1,{ OnInit: bindatcmd "lock",".@pass$","dummy::onlock"; end; onlock: if (.@pass$ == "") { dispbottom "No password entered."; end; } set #pass, .@pass$; dispbottom "Account locked."; } Here is the block for bindatcmd: BUILDIN_FUNC(bindatcmd) { const char* atcmd; const char* eventName; int i, level = 0, level2 = 0; bool create = false; atcmd = script_getstr(st,2); eventName = script_getstr(st,3); if( *atcmd == atcommand_symbol || *atcmd == charcommand_symbol ) atcmd++; if( script_hasdata(st,4) ) level = script_getnum(st,4); if( script_hasdata(st,5) ) level2 = script_getnum(st,5); if( atcmd_binding_count == 0 ) { CREATE(atcmd_binding,struct atcmd_binding_data*,1); create = true; } else { ARR_FIND(0, atcmd_binding_count, i, strcmp(atcmd_binding[i]->command,atcmd) == 0); if( i < atcmd_binding_count ) {/* update existent entry */ safestrncpy(atcmd_binding[i]->npc_event, eventName, 50); atcmd_binding[i]->level = level; atcmd_binding[i]->level2 = level2; } else create = true; } if( create ) { i = atcmd_binding_count; if( atcmd_binding_count++ != 0 ) RECREATE(atcmd_binding,struct atcmd_binding_data*,atcmd_binding_count); CREATE(atcmd_binding[i],struct atcmd_binding_data,1); safestrncpy(atcmd_binding[i]->command, atcmd, 50); safestrncpy(atcmd_binding[i]->npc_event, eventName, 50); atcmd_binding[i]->level = level; atcmd_binding[i]->level2 = level2; } return 0; } Quote Link to comment Share on other sites More sharing options...
Emistry Posted October 17, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 15 hours ago Share Posted October 17, 2012 actually...you can use this.. .@atcmd_parameters$[0] with this...then you dont need to modify your script command.... set #pass$,.@atcmd_parameters$[0]; type @lock <password> and it will be your password....saved in the #pass$ variable Quote Link to comment Share on other sites More sharing options...
Bin4ry Posted October 17, 2012 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 782 Reputation: 82 Joined: 01/01/12 Last Seen: September 21, 2015 Author Share Posted October 17, 2012 Oh damn! I mis-read this: *useatcmd "command"; *useatcmd("command"); This command will execute a custom atcommand on the attached RID from a script. Whether invoked by a script or command, an array .@atcmd_parameters$[] will be filled with the given parameters, starting with an index of 0. Example: @test Testing Command The following array values will be generated: .@atcmd_parameters$[0] = "Testing" .@atcmd_parameters$[1] = "Command" Thank you for reminding me @Emistry! Quote Link to comment Share on other sites More sharing options...
Question
Bin4ry
This is out of my ability
so I'd have to request support from here.
What I'm trying to do is let bindatcmd ability to attach a temp string variable to let use in script.
Hmmm... here is a simple dummy script how would it supposed to work.
Here is the block for bindatcmd:
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.