Jump to content
  • 0

Stolao's Daily Login Reward call with item


Sephiroth91

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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. 

 

 
Link to comment
Share on other sites

21 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  439
  • Reputation:   29
  • Joined:  12/08/11
  • Last Seen:  

Try

donpcevent "LOGIN::OnLoginCmnd";
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@Sephiroth91Maybe change:

prontera,5,5,5 script LOGIN 111,{

 

To:

- script LOGIN -1,{

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

Thanks for your answer. I've already tried that and it doesn't change anything.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@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~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

Then I get the message: NPCEvent 'LOGIN::OnCommandOnLoginCmnd' not found! (source: FAKE_NPC)

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@Sephiroth91try:

cmdothernpc "LOGIN","OnLoginCmnd";

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

That's what I did. Then I get the message:  NPCEvent 'LOGIN::OnCommandOnLoginCmnd' not found! (source: FAKE_NPC)

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@Sephiroth91Rename the Label by replacing all OnLoginCmnd to OnCommandLogin. Than call cmdothernpc "LOGIN","Login";

Don't forget to replace every label calls like Bindcommand and else.

 

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@Sephiroth91Try to add this above to ur item:

callfunc "REWARDCMD",getcharid(3);

 

And use this modified version (not tested):

DailyReward_changed.txt

 

Rynbef~

Edited by Rynbef
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

Oh my mistake. Change:

if(!attachedrid())

 

To:

if(!getattachedrid())

 

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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 ?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@Sephiroth91Maybe try charcommand "@dailyreward";

 

This should exactly like typing in by keyboard.

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

Good idea. Unfortunately, the result is the same.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  881
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/29/14
  • Last Seen:  

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 ?

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