Stolao

Stolao's Daily Login Reward [v2.0B]

Recommended Posts

  • It's impractical to force users to type in 127 reward IDs. I suggest something more like this:
    	// Daily Prize items (max 64 days):
    //   <itemID>,<amount>, // Day 1
    //   <itemID>,<amount>, // Day 2
    //   ...;
    // * If players login longer than the last set
    //   day, they will keep getting the last prize.
    setarray .Rewards[0],
    	512,1,	// Day 1
    	513,2,	// Day 2
    	514,3;	// Day 3
    


  • I really don't understand .Reminder[1] at all. I think you should remove it.
    	// What does this even do?
    if( ( LOGINCOUNT + #LOGINCOUNT + $LOGINCOUNT )%.Reminder[1] == 0 ...


  • .Wipe -- This is really not a good feature how it's currently written. Perhaps allow whispering "wipe" execute an SQL query to delete the values, or just let users do it manually.
    OnWhisperGlobal:
    if (getgmlevel() >= 99 && @whispervar0$ == "wipe") {
    	query_sql("DELETE FROM `global_reg_value` WHERE `str` = 'LOGINCOUNT'");
    	query_sql("DELETE FROM `global_reg_value` WHERE `str` = '#LOGINCOUNT'");
    	query_sql("DELETE FROM `mapreg` WHERE `str` = '$LOGINCOUNT'");
    	dispbottom "Cleared all login count data.";
    }
    end;


  • Your config section is a little confusing, could be formatted better, and needs spell check. Example of an easier-to-read format:
    // -----------------------------------------------------------
    //  Login Count & Welcome Message
    // -----------------------------------------------------------
    
    // Login types to track.
    // 1: Character | 2: Account | 4: Server
    // (a bit value, e.g. 5 = character + server)
    set .LogCount,0;
    
    // Number of logins to display welcome message.
    set .Reminder,3;
    
    // Server name to display.
    set .Servername$,"Server";
    
    // Login message
    set .Message$,"Before playing, make sure you've read the rules, located in our forum at ^0000FF~TBA~^000000";
    


  • Tab properly. In particular, 'else' should always be in-line with 'if'.
  • You don't need to include empty strings in script lines.
    setd ""+.PointType$+"" --> setd .PointType$


  • Upvote 1

Share this post


Link to post
Share on other sites

Thank you very much Euphy ill get right on updating

as for Reminder[1], if the server, account and character login combined are equal to a multiple of Reminder[1] it will message the player with a .Message$ again, kinda pointless but i figured I'd add another option

Edited by Stolao
  • Upvote 1

Share this post


Link to post
Share on other sites

Update v1.17

Share this post


Link to post
Share on other sites

Update, again 1.19 realized had no checkweight in script, added and fixed a small typo

Share this post


Link to post
Share on other sites

query_sql("DELETE FROM `mapreg` WHERE `str` = '$LOGINCOUNT'");

[sql]: DB error - Unknown column 'str' in 'where clause'
[Debug]: at d:\eathena\rathena sql 16819\src\map\script.c:14509 - DELETE FROM `m
apreg` WHERE `str` = '$LOGINCOUNT'
[Debug]: Source (NPC): LOGIN (invisible/not on a map)

you didn't even test this, I doubt it

and all query_sql executing like this probably not going to work out for online players

perhaps using attachrid on all accounts method for online players

and for mapreg, do set $LOGINCOUNT, 0;


[Error]: buildin_checkweight: Invalid item '0'.
[Debug]: Source (NPC): LOGIN (invisible/not on a map)

			if(#DRewardCon*2 > getarraysize(.Rewards)){ 
			set [email protected],.Reward[getarraysize(.Reward)-1]; 
			set [email protected],.Reward[getarraysize(.Reward)];
			} else { 
			set [email protected],.Reward[#DRewardCon*2]; 
			set [email protected],.Reward[#DRewardCon*2+1]; 
		}
		if([email protected] && !checkweight([email protected],[email protected])){
			dispbottom "You cant carry your daily reward, put some items away and log in again";

if #DRewardCon is less than getarraysize(.Rewards), [email protected] is not set

wrong logic also

hmm, but nice try though

Share this post


Link to post
Share on other sites
name='AnnieRuru' timestamp='1359649420' post='176306']

query_sql("DELETE FROM `mapreg` WHERE `str` = '$LOGINCOUNT'");

[sql]: DB error - Unknown column 'str' in 'where clause'
[Debug]: at d:\eathena\rathena sql 16819\src\map\script.c:14509 - DELETE FROM `m
apreg` WHERE `str` = '$LOGINCOUNT'
[Debug]: Source (NPC): LOGIN (invisible/not on a map)

you didn't even test this, I doubt it

and all query_sql executing like this probably not going to work out for online players

perhaps using attachrid on all accounts method for online players

and for mapreg, do set $LOGINCOUNT, 0;


[Error]: buildin_checkweight: Invalid item '0'.
[Debug]: Source (NPC): LOGIN (invisible/not on a map)

			if(#DRewardCon*2 > getarraysize(.Rewards)){
			set [email protected],.Reward[getarraysize(.Reward)-1];
			set [email protected],.Reward[getarraysize(.Reward)];
			} else {
			set [email protected],.Reward[#DRewardCon*2];
			set [email protected],.Reward[#DRewardCon*2+1];
		}
		if([email protected] && !checkweight([email protected],[email protected])){
			dispbottom "You cant carry your daily reward, put some items away and log in again";

if #DRewardCon is less than getarraysize(.Rewards), [email protected] is not set

wrong logic also

hmm, but nice try though

I believe Ive fix the logic issue with #DRewardCon is greater then getarraysize(.Rewards)

  if(#DRewardCon*2 >= getarraysize(.Rewards)){
set [email protected],.Reward[getarraysize(.Reward)-2];
set [email protected],.Reward[getarraysize(.Reward)-1];
} else {
set [email protected],.Reward[#DRewardCon*2];
set [email protected],.Reward[#DRewardCon*2+1];
  }

However Im having trouble with the online players info being removed, im obviously missing something with this code

OnWhisperGlobal:
if (getgmlevel() >= 99 && @whispervar0$ == "wipe") {
 query_sql("DELETE FROM `global_reg_value` WHERE `str` = 'LOGINCOUNT'");
 query_sql("DELETE FROM `global_reg_value` WHERE `str` = '#LOGINCOUNT'");
 set $LOGINCOUNT,0;
 set [email protected], getcharid(3);
 set [email protected], query_sql("select account_id from `char` where online = 1", [email protected]);
 for(set [email protected],0; [email protected]<[email protected]; set [email protected],[email protected]+1) {
  if(attachrid([email protected][[email protected]])){
set LOGINCOUNT,0;
set #LOGINCOUNT,0;
  }

 }
 attachrid([email protected]);
 dispbottom "Cleared all login count data.";
}
end;

[/s]

solved

Edited by Stolao

Share this post


Link to post
Share on other sites

Updated 1.1C fixed issues AnnieRuru found

Updated 1.1F should have all bugs fixed

Edited by Stolao

Share this post


Link to post
Share on other sites

Thank you for your release! Anyways I have a suggestion. How about letting the players whisper the said npc to let them know the remaining time for their next reward? or use a custom @command for checking the remaining time? 

Edited by arzzzae

Share this post


Link to post
Share on other sites

Thanks for suggestion.

Share this post


Link to post
Share on other sites

Thanks for suggestion.

No problem man. I still have several suggestions in my mind, but I guess it will be a hassle for you.

Share this post


Link to post
Share on other sites

Thanks for suggestion.

No problem man. I still have several suggestions in my mind, but I guess it will be a hassle for you.
No please hassle me, I plan on working on Ragnarok stuff all weekend ( weds Thurs for me) and want something for my release.

Edit: typo lol

Edited by Stolao

Share this post


Link to post
Share on other sites

it didn't work.. but no errors..
how to activate it?
sorry, I'm still noob here..

Share this post


Link to post
Share on other sites

it didn't work.. but no errors..

how to activate it?

sorry, I'm still noob here..

 

please load the script bro

 

refer wiki how to add script :)

Share this post


Link to post
Share on other sites

it didn't work.. but no errors..

how to activate it?

sorry, I'm still noob here..

 

please load the script bro

 

refer wiki how to add script :)

the script still same as 1.1F version..

already add that npc to scripts_custom but nothing happen...

Share this post


Link to post
Share on other sites

it didn't work.. but no errors..

how to activate it?

sorry, I'm still noob here..

make sure you have configured and installed correctly, if it still doesn't work with no debug message, post your config here for me.

 

sorry for slow response/updates irl has been bust

Share this post


Link to post
Share on other sites

Hi, I am using your latest script. 1.17 and lately, I am having problems.

 

Here is my errors with my console.

[Debug]: Function: set (2 parameters):
[Debug]: Data: variable name='.PointType$' index=0
[Debug]: Data: param name='Zeny' type=20
[Debug]: Source (NPC): LOGIN (invisible/not on a map)

 

And here is my config:

// -----------------------------------------------------------
//  Login Count & Welcome Message
// -----------------------------------------------------------

	// Login types to track.
	// 1: Character | 2: Account | 4: Server
	// (a bit value, e.g. 5 = character + server)
	set .LogCount,2;

	// Number of logins to display welcome message.
	set .Reminder,1;

	// Server name to display.
	set .Servername$,"Ragnarok Online";

	// Login message
	set .Message$,"Before playing, make sure you've read the rules.";

// -----------------------------------------------------------
//  Daily Reward
// -----------------------------------------------------------

	//Daily Prize
	//Toggle
	//   0: Off  | 1: On
	set .DailyPrize,1;

	//Minimum Hours Between Collecting Daily Reward
	//   Day: 22-24
	//   Week: 168
	set .MinWait,24;

	//Hours Before Lose Consecutive Daily Rewar
	//   Day: 48-50
	//   Week: 336
	set .MaxWait,48;

	//Number of mins after logging before collecting prize
	set .Rest,5;

	//Variable of Points/Zeny earned 
	//   eg: CASHPOINTS, Zeny, LoginPoints
	set .PointType$,Zeny;

	//Name of Points/Zeny earned
	//   eg: Cashpoints, Zeny, Login Points
	set .PointName$,Zeny;

	//Toggle 
	//   0: Gain Zeny Only When ID = 0
	//   1: Gain Zeny Every Loging regardless of prize ID
	set .Mode,0;

	//Consecutive Day Points/Zeny Multiplier
	// * If players login longer than the last set
	//   day, they will keep a larger Multiplier.
	set .ZMulti,0;

	// Daily Prize items (max 64 days):
	//   <itemID>,<amount>, // Day 1
	//   <itemID>,<amount>, // Day 2
	//   ...;
	// * If players login longer than the last set
	//   day, they will keep getting the last prize.
	setarray .Rewards[0],
		617,1,		// Day 1
		

end;
}

 

 

I don't want the zeny rewards, etc. I just want to give 1 item to the players.

Share this post


Link to post
Share on other sites
	//Variable of Points/Zeny earned 
	//   eg: CASHPOINTS, Zeny, LoginPoints
	set .PointType$,Zeny;

	//Name of Points/Zeny earned
	//   eg: Cashpoints, Zeny, Login Points
	set .PointName$,Zeny;

 

Try putting "Zeny" with quotes

 

sorry for slow response irl is busy

Edited by Stolao

Share this post


Link to post
Share on other sites

haha.. thanks guys.. it's working now..
/ok really nice script..

Share this post


Link to post
Share on other sites

Welcome, and thank you.

 

I plan to update sometime when i get a chance, real life's hectic but YAY~ bought my 1st car

Share this post


Link to post
Share on other sites

Update

1.1F -> 1.2F

1.20 Changed .Reminder to .Welcome
1.21 Fixed missing details in Welcome Message
1.22 Changed .Mode to be bitwise
1.23 Added Item enable disable to .Mode
1.24 Changed whisper to allow for player Whispers
1.25 Added "time" Whisper Command for players
1.26 Made Whisper commands configurable
1.27 Made GmLvl for wipe Configurable
1.28 Fixed "Points" bitwise
1.29 Added Exp to .Mode
1.2A Optimized Rewards Script a little
1.2B Bug Fix with Display message on reviving rewards
1.2C Optimize a little more
1.2D Added server xp rate to config
1.2F Re-added Checkweight
Edited by Stolao

Share this post


Link to post
Share on other sites

Your welcome, if have any suggestions let me know :)

Share this post


Link to post
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
Reply to this topic...

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

Loading...