Jump to content
  • 0

Stolao's Daily Login Reward call with item


Question

Posted

Hello, 

I'm trying to call the dailyreward command from the script with an item. If I call the dailyreward command with the item via the atcommand, I get the message that the command does not exist, but if I enter it with @dailyreward, it works.

I've tried calling the script with callfunc but this didn't work either. my goal is that the player can call up the script with an item and he doesn't have to enter a command in the chat.

I hope someone can help me here I've been looking for a solution the last days. 

 

 

21 answers to this question

Recommended Posts

  • 0
Posted

@Sephiroth91their is a script command that's special for commands defined by bindatcmd.

*useatcmd "<command>";

 

This command will execute a script-bound atcommand for the attached RID. If the

supplied command is not bound to any script, this command will act like 'atcommand'

and attempt to execute a source-defined command.

 

 

Rynbef~

  • Love 1
  • 0
Posted (edited)

When I try this I get the error:

[Warning]: script:get_val: cannot access player variable '#LastDailyReward', defaulting to 0
[Error]: get_val_: fatal error ! player not attached!
[Debug]: Source (NPC): dailyreward (invisible/not on a map)
[Debug]: Source (NPC): dailyreward is located in: npc/custom/sephiroth/dailyreward.txt
[Warning]: script:get_val: cannot access player variable '#LastDailyReward', defaulting to 0

 

When I try: donpcevent "dailyreward",strnpcinfo(3)+"::OnLoginCmnd";

then nothing happens, no error, but the script is not called either

Edited by Sephiroth91
  • 0
Posted

@Sephiroth91Maybe add this on ur item:

 

cmdothernpc "<npc name>","<command>"; This is simply "donpcevent <npc name>::OnCommand<command>". It is an approximation of official server script language's 'cmdothernpc'. Returns true if the command was executed on the other NPC successfully, false if not

 

Rynbef~

  • 0
Posted

I implemented it exactly as you said and then I got the following error:

[Error]: buildin_strcharinfo: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0
[Debug]: Source (NPC): LOGIN (invisible/not on a map)
[Debug]: Source (NPC): LOGIN is located in: npc/custom/sephiroth/dailyreward.txt
[Debug]: Source (NPC): LOGIN (invisible/not on a map)
[Debug]: Source (NPC): LOGIN is located in: npc/custom/sephiroth/dailyreward.txt

  • 0
Posted

I got the following error;

[Error]:
script error on npc/custom/sephiroth/dailyreward.txt line 50
    parse_simpleexpr: unmatched ')'
    47 : {
    48 :
    49 :     if(getargcount()){
*   50 :         if(!attachedrid'('))
    51 :             attachrid(getarg(0));
    52 :                donpcevent "LOGIN::OnLoginCmnd";
    53 :       //  atcommand "@dailyreward";
    54 :         detachrid;
    55 :     }
 

If I comment out the erroneous line, because it is only a check at the point I get the message that the command dailyreward is unknown.

Thank you very much for your help so far I appreciate this very much.

  • 0
Posted

At the console it runs no error at the start , no  error while using the item.

If i use it ingame the items says: @dailyreward is unknown command.  Writing to the chat is also fine . No problems.    is it nessacarry that  bindcmds  only run by typing per hand ?

  • 0
Posted (edited)

@Sephiroth91Try to change:

 bindatcmd("dailyreward",strnpcinfo(3)+"::OnLoginCmnd",0,99);

 

To:

 bindatcmd("dailyreward",strnpcinfo(3)+"::OnLoginCmnd");

Or if it won't work:

bindatcmd("dailyreward","LOGIN::OnLoginCmnd");

 

Rynbef~

Edited by Rynbef
Removed empty lines/tagged member
  • 0
Posted

I tried the first suggestion myself yesterday and it didn't work. With the second proposal comes again the same result unknown command.

I have now tried something completely new. I made my own atcommand in the src which only does a text output and called the command dailyreward. If I enter @dailyreward in the chat the reward script is called. If I use the item only the text output from the src is output but both are the same command but brings a completely different result. I suspect that a bindcmd actually only works in the chat and not via a call (Maybe an emulator error?).

This means that calling the script via an item would only be possible for me if I write an atcommand in the src what the script calls. But I have no idea how to do it. Do you have an idea @Rynbef or someone else?

  • 0
Posted (edited)

@Sephiroth91

 

1st suggestion change:

bindatcmd("dailyreward",strnpcinfo(3)+"::OnLoginCmnd");

 

To:

bindatcmd("dailyreward",strnpcinfo(3)+"::OnLoginCmnd",0,0);

 

2nd suggestion: U've also tested with my function? This function attach the player and use the command.

 

Rynbef~

Edited by Rynbef
  • 0
Posted

Sorry for the late answer@Rynbef Much work on my todolist the last days. 

1st: no change, it also  says @dailyreward is unknown command

2nd:  of course I try it all the time, only with your function since the server does not complain anymore that nothing is attached but the comand still does not work

 

I have used the command in the itemdb in my item and now the script is working.   Your command is not nessary. 

Thanks for your time and help ?

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