Jump to content
  • 0

15 minute reward


mrlongshen

Question


  • Group:  Members
  • Topic Count:  98
  • Topics Per Day:  0.02
  • Content Count:  1302
  • Reputation:   77
  • Joined:  12/04/12
  • Last Seen:  

-    script    hourlypoints    -1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;

OnTimer1000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
dispbottom "The hourly badge rewards has stopped because you were vending / Pub Room. Please re-log if you wish to start again.";
stopnpctimer;
end;
}

OnTimer5000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 15){
set @minute,0;
set #CASHPOINTS, #CASHPOINTS + 20;
dispbottom "You received 20 CASHPOINTS for staying 15 minute in-game.";
set @consecutive_hour, @consecutive_hour + 1;
}
//Check for 1 hours consecutive
if(@consecutive_hour == 1) {
set @consecutive_hour,0;
set #CASHPOINTS, #CASHPOINTS + 100;
dispbottom "You received 100 CASHPOINTS for staying 1 hours in-game.";
}
stopnpctimer;
initnpctimer;
end;

}

i try edit to every 15 minute got reward. but i not get the reward.. can someone fix it ? 

Edited by mrlongshen
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

I think you are making this easier when you use

OnMinute00:
OnMinute15:
OnMinute30:
OnMinute45:
The code below these labels will run each 15 minutes.

Try revising your script using these labels and if your script still does not work properly, please also post the error messages displayed by your map server the next time.

Edited by Xynvaroth
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Using

OnMinute00:

OnMinute15:

OnMinute30:

OnMinute45:

Wont work either, because if the player logins on minute 14th, they'll get the reward in just a minute away.

-    script    hourlypoints    -1,{

//--Start of the Script

OnPCLoginEvent:

attachnpctimer ""+strcharinfo(0)+"";

initnpctimer;

end;

OnTimer1000:

//Check if Vending (normal or @at)

if(checkvending() >= 1 || checkchatting() == 1) {

dispbottom "The hourly badge rewards has stopped because you were vending / Pub Room. Please re-log if you wish to start again.";

stopnpctimer;

end;

}

OnTimer60000:

set @minute, @minute + 1;

//Check for 1 Minute

if(@minute == 15){

set @minute,0;

set #CASHPOINTS, #CASHPOINTS + 20;

dispbottom "You received 20 CASHPOINTS for staying 15 minute in-game.";

set @consecutive_hour, @consecutive_hour + 1;

}

//Check for 1 hours consecutive

if(@consecutive_hour == 4) {

set @consecutive_hour,0;

set #CASHPOINTS, #CASHPOINTS + 100;

dispbottom "You received 100 CASHPOINTS for staying 1 hours in-game.";

}

initnpctimer;

end;

}

Your code won't work because you're detaching RID everytime the loop ends.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

Using

OnMinute00:
OnMinute15:
OnMinute30:
OnMinute45:
Wont work either, because if the player logins on minute 14th, they'll get the reward in just a minute away.
You can not generalise that it will not work, because it will depend on how the other part is realised.

If you use a variable and increase it by one everytime one of these events is run, you will be able to see how long they actually stayed online.

However, that is just a rough plan; there will be needed more work to be done to ensure they do not log in every 15 minutes and so on.

To prevent losing the RID, you could either use the OnMinuteXX labels I have suggested, or you use the sleep2 x; function which will pause the script for x seconds while keeping the RID attached.

Edited by Xynvaroth
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Well, first off this can easily be made with a Sleep2 Infinite loop.

-    script    play_time    -,{
OnPCLoginEvent:
iSleeploop:
sleep2 900000;
set @playtime,@playtime+1;
set #CASHPOINTS, #CASHPOINTS + 20;
if(@playtime == 4){ set #CASHPOINT, #CASHPOINTS + 100; set @playtime,0; dispbottom "You've been rewarded 100 CASHPOINTS for playing for 1 consecutive hour."; goto iSleepLoop;}
dispbottom "You've been rewarded 20 CASHPOINTS for playing for "+ ( 15 * @playtime ) +" minutes.";
goto iSleepLoop:
end;
}

 

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

Well, first off this can easily be made with a Sleep2 Infinite loop.

-    script    play_time    -,{
OnPCLoginEvent:
iSleeploop:
sleep2 900000;
set @playtime,@playtime+1;
set #CASHPOINTS, #CASHPOINTS + 20;
if(@playtime == 4){ set #CASHPOINT, #CASHPOINTS + 100; set @playtime,0; dispbottom "You've been rewarded 100 CASHPOINTS for playing for 1 consecutive hour."; goto iSleepLoop;}
dispbottom "You've been rewarded 20 CASHPOINTS for playing for "+ ( 15 * @playtime ) +" minutes.";
goto iSleepLoop:
end;
}

That might be easier to understand, but the downside is that you will have as many scripts additionally running as the amount of players who are currently online is.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

@Xynvaroth - Yea, I realized that. But this was just a way to show them a simplified version. Additionally, even if they run it the old way, with OnTimerXXXX: It will still run 1 script per player. Not including those who have stayed AFK/Vending. Though, with the simplified version, this can all be checked and verified as well. So, the only thing they need to do now, is filter out the vender's and AFK people. Normally that would reduce the script count by 15-20% depending on server population.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

The difference is that the OnXX solution will end after triggering, while the sleep2 command causes the server to keep the script saved in a running - yet frozen - state.

Eventually, everyone will have to decide her- or himself whether rather using a more complicated, but less resourcement intensive solution, or a easier to understand solution.

That said, I did not want to give you the feeling that your solution is wrong in whatever way; sorry if that happened.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Oh no, of course not lol. I'm not one to take anything over the internet to heart lol. I was just merely replying to give acknowledgement of my viewing and understanding your concerns. However I do agree that would be a choice they'd have to make for themselves.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

-	script	VIPLuckyPick	-1,{
OnInit:
OnClock0000:
	set .LuckyTime,rand(24);

OnMinute00:
	if( gettime(3) == .LuckyTime ){
	set .DelayMin,rand(60);
	sleep ( .DelayMin * 60000 );
	while(1){
	query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
	attachrid .@aid;
	if( CheckVending() || !getgmlevel() || @afk == 15 ){
	DetachRID();
	continue;
	}
	announce strcharinfo(0) +" won in Lucky Pick Event.", 0;
	getitem 7539,1000;
	break;
	}
}
end;
}

 

I get this from @Emistry , I know that's not for 15 minutes like you ask. It's for random hours & minutes. The script working perfectly for me.

 

Maybe other scripters will help you to change it to 15 minutes like you ask.

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