Jump to content
  • 0

Fix Account - Daily Rewards


Lukasek

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  11/23/12
  • Last Seen:  

Hello,
How can I change reward for only account. In this script

 

-	script	Coin Reward	-1,{
OnPCLoginEvent:
	.@pow = 1 << 10;
	.@todays = gettime(8);
	if ( login_reward % .@pow == .@todays ) end;
	.@count += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % .@pow ) ) + .@todays + .@pow;// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != .@todays + .@pow ) {// login_reward was not empty
		.@count_day = ( login_reward >> 10 ) % .@pow;
		.@cond_ofthemonth = ( ( login_reward >> 30 ) % .@pow ) != ( .@count_day / 31 );
		if ( ( ( login_reward >> 20 ) % .@pow ) != ( .@count_day / 7 ) ) {
			.@count += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			.@weekly_message$ = ( .@cond_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( .@cond_ofthemonth ) {
			.@count += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			.@montly_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, .@count;
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ .@weekly_message$ + .@montly_message$ +".";
	end;
OnInit:
	.reward_day = 1;
	.reward_week = 2;
	.reward_month = 3;
	end;
}

Thank You

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

I use your code and this is the simple way to do it

.@todays = gettime(5);
if ( #login_reward != .@todays ) {
//Get item here
getitem 501,1;
set #login_reward,.@todays;
}
mes "You already have the reward";
end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  11/23/12
  • Last Seen:  

Its not function

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

17 minutes ago, Lukasek said:

Its not function

You mean you want to change the item reward into account bound ?

HERE

*getitembound <item id>,<amount>,<bound type>{,<account ID>};
*getitembound "<item name>",<amount>,<bound type>{,<account ID>};

This command behaves identically to 'getitem', but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.

Valid bound types are:
 Bound_Account : Account Bound item
 Bound_Guild   : Guild Bound item
 Bound_Party   : Party Bound item
 Bound_Char    : Character Bound item

 

Change your
 

getitem 675, .@count;


Into
 

getitembound 675,  .@count, Bound_Account;

 

Edited by Poring King
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  11/23/12
  • Last Seen:  

I need one reward for the whole account for day.

 

//this script is for every char on account, I need One reward for whole account and not character.
-	script	Coin Reward	-1,{
OnPCLoginEvent:
	.@pow = 1 << 10;
	.@todays = gettime(8);
	if ( login_reward % .@pow == .@todays ) end;
	.@count += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % .@pow ) ) + .@todays + .@pow;// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != .@todays + .@pow ) {// login_reward was not empty
		.@count_day = ( login_reward >> 10 ) % .@pow;
		.@cond_ofthemonth = ( ( login_reward >> 30 ) % .@pow ) != ( .@count_day / 31 );
		if ( ( ( login_reward >> 20 ) % .@pow ) != ( .@count_day / 7 ) ) {
			.@count += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			.@weekly_message$ = ( .@cond_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( .@cond_ofthemonth ) {
			.@count += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			.@montly_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, .@count;
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ .@weekly_message$ + .@montly_message$ +".";
	end;
OnInit:
	.reward_day = 1;
	.reward_week = 2;
	.reward_month = 3;
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

Just now, Lukasek said:

I need one reward for the whole account for day.

 


//this script is for every char on account, I need One reward for whole account and not character.
-	script	Coin Reward	-1,{
OnPCLoginEvent:
	.@pow = 1 << 10;
	.@todays = gettime(8);
	if ( login_reward % .@pow == .@todays ) end;
	.@count += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % .@pow ) ) + .@todays + .@pow;// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != .@todays + .@pow ) {// login_reward was not empty
		.@count_day = ( login_reward >> 10 ) % .@pow;
		.@cond_ofthemonth = ( ( login_reward >> 30 ) % .@pow ) != ( .@count_day / 31 );
		if ( ( ( login_reward >> 20 ) % .@pow ) != ( .@count_day / 7 ) ) {
			.@count += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			.@weekly_message$ = ( .@cond_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( .@cond_ofthemonth ) {
			.@count += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			.@montly_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, .@count;
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ .@weekly_message$ + .@montly_message$ +".";
	end;
OnInit:
	.reward_day = 1;
	.reward_week = 2;
	.reward_month = 3;
	end;
}

 

I give you what you need bro -.-

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  11/23/12
  • Last Seen:  

At the moment this script gives to each character coin, but I need to get only one character a coin everyday.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

21 minutes ago, Lukasek said:

At the moment this script gives to each character coin, but I need to get only one character a coin everyday.

Look my code i add "(#)" On #Login_reward then i also add "set #Login_reward, .@todays"


Try this made on phone

-	script	Coin Reward	-1,{
OnPCLoginEvent:
	.@pow = 1 << 10;
	.@todays = gettime(8);
	if ( #login_reward % .@pow == .@todays ) end;
	.@count += .reward_day;// reward of the day
	#login_reward = ( login_reward &~ ( login_reward % .@pow ) ) + .@todays + .@pow;// update day and count day +1 ; day/count day/check week/check month
	if ( #login_reward != .@todays + .@pow ) {// login_reward was not empty
		.@count_day = ( #login_reward >> 10 ) % .@pow;
		.@cond_ofthemonth = ( ( #login_reward >> 30 ) % .@pow ) != ( .@count_day / 31 );
		if ( ( ( #login_reward >> 20 ) % .@pow ) != ( .@count_day / 7 ) ) {
			.@count += .reward_week;
			#login_reward = #login_reward + pow( 2,20 );
			.@weekly_message$ = ( .@cond_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( .@cond_ofthemonth ) {
			.@count += .reward_month;
			#login_reward = #login_reward + pow( 2,30 );
			.@montly_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, .@count;
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ .@weekly_message$ + .@montly_message$ +".";
	set #login_reward,.@todays;
	end;
OnInit:
	.reward_day = 1;
	.reward_week = 2;
	.reward_month = 3;
	end;
}

 

Edited by Poring King
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

interesting script, but low readability

		if ( .@cond_ofthemonth ) {
			.@count += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			.@montly_message$ = " and " + .reward_month +" coin for being online a month";
		}

if I understood this correctly, this means... if I being online everyday for 2 months
on 1st month, no problem
but on 2nd month, login += pow(2,30) again and will cause integer overflow

I think just use a simple daily login script like Poring King provided earlier ... if its bug, anyone can fix it easily,
not like this one using confusing bitmask where it doesn't actually saving in bits ...

Edited by AnnieRuru
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...