Jump to content
  • 0
Lukasek

Fix Account - Daily Rewards

Question

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

 

-	script	Coin Reward	-1,{
OnPCLoginEvent:
	[email protected] = 1 << 10;
	[email protected] = gettime(8);
	if ( login_reward % [email protected] == [email protected] ) end;
	[email protected] += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % [email protected] ) ) + [email protected] + [email protected];// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != [email protected] + [email protected] ) {// login_reward was not empty
		[email protected]_day = ( login_reward >> 10 ) % [email protected];
		[email protected]_ofthemonth = ( ( login_reward >> 30 ) % [email protected] ) != ( [email protected]_day / 31 );
		if ( ( ( login_reward >> 20 ) % [email protected] ) != ( [email protected]_day / 7 ) ) {
			[email protected] += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			[email protected]_message$ = ( [email protected]_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( [email protected]_ofthemonth ) {
			[email protected] += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			[email protected]_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, [email protected];
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ [email protected]_message$ + [email protected]_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

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

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

 

Link to comment
Share on other sites

  • 0
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, [email protected];


Into
 

getitembound 675,  [email protected], Bound_Account;

 

Edited by Poring King
Link to comment
Share on other sites

  • 0

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:
	[email protected] = 1 << 10;
	[email protected] = gettime(8);
	if ( login_reward % [email protected] == [email protected] ) end;
	[email protected] += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % [email protected] ) ) + [email protected] + [email protected];// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != [email protected] + [email protected] ) {// login_reward was not empty
		[email protected]_day = ( login_reward >> 10 ) % [email protected];
		[email protected]_ofthemonth = ( ( login_reward >> 30 ) % [email protected] ) != ( [email protected]_day / 31 );
		if ( ( ( login_reward >> 20 ) % [email protected] ) != ( [email protected]_day / 7 ) ) {
			[email protected] += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			[email protected]_message$ = ( [email protected]_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( [email protected]_ofthemonth ) {
			[email protected] += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			[email protected]_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, [email protected];
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ [email protected]_message$ + [email protected]_message$ +".";
	end;
OnInit:
	.reward_day = 1;
	.reward_week = 2;
	.reward_month = 3;
	end;
}

 

Link to comment
Share on other sites

  • 0
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:
	[email protected] = 1 << 10;
	[email protected] = gettime(8);
	if ( login_reward % [email protected] == [email protected] ) end;
	[email protected] += .reward_day;// reward of the day
	login_reward = ( login_reward &~ ( login_reward % [email protected] ) ) + [email protected] + [email protected];// update day and count day +1 ; day/count day/check week/check month
	if ( login_reward != [email protected] + [email protected] ) {// login_reward was not empty
		[email protected]_day = ( login_reward >> 10 ) % [email protected];
		[email protected]_ofthemonth = ( ( login_reward >> 30 ) % [email protected] ) != ( [email protected]_day / 31 );
		if ( ( ( login_reward >> 20 ) % [email protected] ) != ( [email protected]_day / 7 ) ) {
			[email protected] += .reward_week;
			login_reward = login_reward + pow( 2,20 );
			[email protected]_message$ = ( [email protected]_ofthemonth ? ", " : " and " ) + .reward_week +" coin for being online a week";
		}
		if ( [email protected]_ofthemonth ) {
			[email protected] += .reward_month;
			login_reward = login_reward + pow( 2,30 );
			[email protected]_message$ = " and " + .reward_month +" coin for being online a month";
		}
	}
	getitem 675, [email protected];
	dispbottom "Here your daily reward ! You got "+ .reward_day +" coin"+ [email protected]_message$ + [email protected]_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
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, [email protected]"


Try this made on phone

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

 

Edited by Poring King
Link to comment
Share on other sites

  • 0

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.