Jump to content
  • 0

how to maintain the timer in the event


simplemhan

Question


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  308
  • Reputation:   3
  • Joined:  12/18/11
  • Last Seen:  

i would like to mantain the timer in the event


 


example like this:


 


jumper will run every 30 mins


 


00:30


01:30


02:30


03:30


 


etc etc how do i need to do that bcoz im new in scripting want to learn something

 

which one is right

 

OnClock0030:

OnClock0130:

 

or

OnHour0030:

OnHour0130:

 

can you tell me the difference?

Link to comment
Share on other sites

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

OnClock<Hour><Minute> will be triggered when the clock eaches <Hour>:<Minute>. Examples: OnClock0110 will be triggered at 1:10 am, OnClock1910 will be triggered at 7.10 pm.

OnHour<Hour> will be triggered when the clock reaches the hour <Hour>. Examples: OnHour01 will be triggered at 1 am, OnHour20 at 8 pm

If you want to repeat something every 30 minutes the whole day, I would suggest you the following:

OnInit:
	while( 1 ) {
		<Your code here>
		sleep 1800000; // 1000 (one second) * 60 (one minute) * 30 (thirty minutes)
	}
Elsewise you would have to put many labels there...

Edit: Yes, Capuche, you are right!

Edited by Xynvaroth
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Examples: OnHour0110 will be triggered at 1:10 am, OnHour1910

you mean OnClock instead of OnHour here

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  308
  • Reputation:   3
  • Joined:  12/18/11
  • Last Seen:  

 

Examples: OnHour0110 will be triggered at 1:10 am, OnHour1910

you mean OnClock instead of OnHour here

blank.gifcan you edit this every 30 mins but have a gapped of 30 mins also

-    script    jumpevent    -1,{

    OnWhisperGlobal:
    if ( getgmlevel() < 99 ) end;

    L_JumpAdmin:
    mes "[Manager]";
    mes "^FF0000~Hi GM " + strcharinfo(0) + "!~^000000";
    mes "^FF0000The Current Prize is:^000000";
    mes "^FF00001. Random Prize:^000000 ^008000"+$jmp_item_amount1+" "+getitemname($jmp_item_id1)+"^000000";
    mes "^FF00002. Random Prize:^000000 ^008000"+$jmp_item_amount2+" "+getitemname($jmp_item_id2)+"^000000";
    mes "^FF00003. Random Prize:^000000 ^008000"+$jmp_item_amount3+" "+getitemname($jmp_item_id3)+"^000000";
    switch(select("Start Jump Event?:Set Prize:Not today Fellas!")){

        case 1:
            next;
            if( $@JumpStart == 1 ){
            mes "[Manager]";
            mes "I Can't Start The Event!!";
            mes "The Event is still ON!!";
            next;
            goto L_JumpAdmin;
            }
            next;
            mes "[Manager]";
            mes "^FF0000~Sure thing!~^000000";
            close2;
            goto L_StartJmp;

        case 2:
            next;
            mes "[Manager]";
            mes "^FF0000~What should the prize for winning be? Please input the ID.~^000000";
            menu "Set Prize 1",SP1,"Set Prize 2",SP2,"Set Prize 3",SP3,"Go Back to main",L_JumpAdmin;

        SP1:
        next;
        mes "[Manager]";
        mes "^FF0000~What should the prize for winning be? Please input the ID.~^000000";
        input $jmp_item_id1;
        next;
        mes "[Manager]";
        mes "^FF0000~How many if this item should I give away?~^000000";
        input $jmp_item_amount1;
        next;
        mes "[Manager]";
        mes "^FF0000~So, the prize is^000000 ^008000"+ $jmp_item_amount1 +" "+ getitemname($jmp_item_id1) +"^000000? ^FF0000Great.~^000000";
        next;
        goto L_JumpAdmin;

        SP2:
        next;
        mes "[Manager]";
        mes "^FF0000~What should the prize for winning be? Please input the ID.~^000000";
        input $jmp_item_id2;
        next;
        mes "[Manager]";
        mes "^FF0000~How many if this item should I give away?~^000000";
        input $jmp_item_amount2;
        next;
        mes "[Manager]";
        mes "^FF0000~So, the prize is^000000 ^008000"+ $jmp_item_amount2 +" "+ getitemname($jmp_item_id2) +"^000000? ^FF0000Great.~^000000";
        next;
        goto L_JumpAdmin;

        SP3:
        next;
        mes "[Manager]";
        mes "^FF0000~What should the prize for winning be? Please input the ID.~^000000";
        input $jmp_item_id3;
        next;
        mes "[Manager]";
        mes "^FF0000~How many if this item should I give away?~^000000";
        input $jmp_item_amount3;
        next;
        mes "[Manager]";
        mes "^FF0000~So, the prize is^000000 ^008000"+ $jmp_item_amount3 +" "+ getitemname($jmp_item_id3) +"^000000? ^FF0000Great.~^000000";
        next;
        goto L_JumpAdmin;

        Case 3:
            next;
            mes "[Manager]";
            mes "Bye!!";
            close;

        }// End Admin Manager...

    OnClock0030:
    OnClock0130:
    OnClock0230:
    OnClock0330:
    OnClock0430:
    OnClock0530:
    OnClock0630:
    OnClock0730:
    OnClock0830:
    OnClock0930:
    OnClock1030:
    OnClock1130:
    L_StartJmp:
    announce "Jumper Event : will begin in 20 seconds",bc_blue;
    sleep2 5000;
    announce "Jumper Event : I'm Going to JUMP somewhere..!!",bc_blue;
    sleep2 5000;
    announce "Jumper Event : By the way I'm going to disguise into a random monster.!!",bc_blue;
    sleep2 10000;
    announce "Jumper Event : Last 10 seconds",bc_blue;
    sleep2 10000;
    set $@ran, rand(1,10);
    if ($@ran == 10) set $@jmpmap$,"hugel";
    if ($@ran == 9) set $@jmpmap$,"yuno";
    if ($@ran == 8) set $@jmpmap$,"comodo";
    if ($@ran == 7) set $@jmpmap$,"xmas";
    if ($@ran == 6) set $@jmpmap$,"aldebaran";
    if ($@ran == 5) set $@jmpmap$,"izlude";
    if ($@ran == 4) set $@jmpmap$,"payon";
    if ($@ran == 3) set $@jmpmap$,"geffen";
    if ($@ran == 2) set $@jmpmap$,"morocc";
    if ($@ran == 1) set $@jmpmap$,"prontera";
    announce "Jumper Event : Go Find me!! I'm here in "+$@jmpmap$+"!!!",bc_blue;
    set $@JmpRnd,10;
    goto OnStart;

    OnStart:
    if ($@JmpRnd == 0){
    stopnpctimer;
    set $@JumpStart,0;
    sleep2 3000;
    announce "Jumper Event : is now OVER!!",bc_blue;
    sleep2 15000;
    movenpc "Jumper"+$@ran+"",1,1; //move the NPC
    setnpcdisplay "Jumper"+$@ran+"",1002;
    end;
    }
    if ($@JmpRnd == 10){
    goto OnStart2;
    }
    stopnpctimer;
    sleep2 3000;
    announce "Jumper Event : Next Round will begin in 15 seconds...",bc_blue;
    sleep2 15000;
    setnpcdisplay "Jumper"+$@ran+"",1002;
    movenpc "Jumper"+$@ran+"",1,1; //move the NPC
    set $@ran, rand(1,10);
    if ($@ran == 10) set $@jmpmap$,"hugel";
    if ($@ran == 9) set $@jmpmap$,"yuno";
    if ($@ran == 8) set $@jmpmap$,"comodo";
    if ($@ran == 7) set $@jmpmap$,"xmas";
    if ($@ran == 6) set $@jmpmap$,"aldebaran";
    if ($@ran == 5) set $@jmpmap$,"izlude";
    if ($@ran == 4) set $@jmpmap$,"payon";
    if ($@ran == 3) set $@jmpmap$,"geffen";
    if ($@ran == 2) set $@jmpmap$,"morocc";
    if ($@ran == 1) set $@jmpmap$,"prontera";
    announce "Jumper Event : Go Find me!! I'm here in "+$@jmpmap$+"!!!",bc_blue;
    goto OnStart2;

    OnStart2:
    set $monster, rand(1001,1995);
    if($monster == 1003 || $monster == 1218 || $monster == 1006 || $monster == 1017 || $monster == 1021 || $monster == 1022 || $monster == 1027 || $monster == 1043 || $monster == 1006 || $monster == 1136 || $monster == 1137 || $monster == 1168 || $monster == 1171 || $monster == 1172 || $monster == 1173 || $monster == 1181 || $monster == 1210 || $monster == 1223 || $monster == 1284 || ($monster >= 1324 && $monster <= 1363) || $monster == 1006 || $monster == 1407 || $monster == 1411 || $monster == 1414 || $monster == 1496 || $monster == 1501 || $monster == 1900){ goto OnStart2; end; }
    while(1) { //Initiate an infinite loop
    set $@jx,rand(0,300); //Set a randon X coordinate
    set $@jy,rand(0,300); //Set a random Y coordinate
    if(checkcell(""+$@jmpmap$+"",$@jx,$@jy,cell_chkpass)) break; //If cell is walkable break out of the loop
    }
    initnpctimer;
    set $@JumpStart,1;
    movenpc "Jumper"+$@ran+"",$@jx,$@jy; //move the NPC
    setnpcdisplay "Jumper"+$@ran+"",$monster;
    set $@JmpRnd,$@JmpRnd-1;
    end;

    OnTimer60000:
    set $@JumpStart,0;
    announce "Jumper Event : WOW no One Found ME!! I'm here in "+$@jmpmap$+" "+$@jx+" "+$@jy+"!!",bc_blue;
    sleep2 3000;
    donpcevent "jumpevent::OnStart";
    end;

}//End Script

-    script    Jumper    -1,{
    if( $@JumpStart == 0 ){
    mes "[Jumper]";
    mes "I'm sorry, Someone Found me..";
    close;
    }
    set $@prize, rand(1,100);
    if ( $@prize <= 50 ){
    set $@JumpStart,0;
    getitem $jmp_item_id1,$jmp_item_amount1;
    announce "Jumper Event : "+strcharinfo(0)+" is the WINNER!! I'm here in "+$@jmpmap$+" "+$@jx+" "+$@jy+"!!",bc_blue;
    donpcevent "jumpevent::OnStart";
    mes "[Jumper]";
    mes "WOW you found me!!";
    mes "Take this as a REWARD!!";
    mes "You got ^008000"+ $jmp_item_amount1 +" "+ getitemname($jmp_item_id1) +"^000000";
    close;
    end;
    }
    set $@prize, rand(1,100);
    if ( $@prize <= 49 ){
    set $@JumpStart,0;
    getitem $jmp_item_id2,$jmp_item_amount2;
    announce "Jumper Event : "+strcharinfo(0)+" is the WINNER!! I'm here in "+$@jmpmap$+" "+$@jx+" "+$@jy+"!!",bc_blue;
    donpcevent "jumpevent::OnStart";
    mes "[Jumper]";
    mes "WOW you found me!!";
    mes "Take this as a REWARD!!";
    mes "You got ^008000"+ $jmp_item_amount2 +" "+ getitemname($jmp_item_id2) +"^000000";
    close;
    end;
    }
    set $@prize, rand(1,100);
    if ( $@prize <= 48 ){
    set $@JumpStart,0;
    getitem $jmp_item_id3,$jmp_item_amount3;
    announce "Jumper Event : "+strcharinfo(0)+" is the WINNER!! I'm here in "+$@jmpmap$+" "+$@jx+" "+$@jy+"!!",bc_blue;
    donpcevent "jumpevent::OnStart";
    mes "[Jumper]";
    mes "WOW you found me!!";
    mes "Take this as a REWARD!!";
    mes "You got ^008000"+ $jmp_item_amount3 +" "+ getitemname($jmp_item_id3) +"^000000";
    close;
    end;
    }
}//End Script

prontera,1,1,1    duplicate(Jumper)    Jumper1    1002
morocc,1,1,1    duplicate(Jumper)    Jumper2    1002
geffen,1,1,1    duplicate(Jumper)    Jumper3    1002
payon,1,1,1    duplicate(Jumper)    Jumper4    1002
izlude,1,1,1    duplicate(Jumper)    Jumper5    1002
aldebaran,1,1,1    duplicate(Jumper)    Jumper6    1002
xmas,1,1,1    duplicate(Jumper)    Jumper7    1002
comodo,1,1,1    duplicate(Jumper)    Jumper8    1002
yuno,1,1,1    duplicate(Jumper)    Jumper9    1002
hugel,1,1,1    duplicate(Jumper)    Jumper10    1002

thanks

I want to make my event dont occur the other events

 

example like this:

 

poring catcher every 15 mins

jumper every 30 mins

disguise every 45 mins

lucky pick every 60 mins

 

poring catcher 0015

jumper 0030

disguise 0045

luckypick 0100

 

poring catcher 0115

jumper 0130

disguise 0145

luckypick 0200

 

etc

etc

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

you mean at every 30 (1:30, 2:30, 3:30 etc..) the event start ?



Then replace

    OnClock0030:
    OnClock0130:
    OnClock0230:
    OnClock0330:
    OnClock0430:
    OnClock0530:
    OnClock0630:
    OnClock0730:
    OnClock0830:
    OnClock0930:
    OnClock1030:
    OnClock1130:

by

OnMinute30:// start at every 30 mins of an hour
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:  

I want to make my event dont occur the other events

 

example like this:

 

poring catcher every 15 mins

jumper every 30 mins

disguise every 45 mins

lucky pick every 60 mins

In your example the events will happen at the same time, because, for instance, if the "Poring Catcher" happens every 15 minutes, then it will also happen every 30 minutes...

If you would like to make them happen after each other with a break of 15 minutes, you could do it this way:

"Poring Catcher" happens every full hour:

OnMinute00:
"Jumper" happens at the 15th minute of each hour:
OnMinute15:
"Disguise" happens at the 30th minute of each hour:
OnMinute30:
"Lucky Pick" happens at the 45th minute of each hour:
OnMinute45:
Is this what you need? Edited by Xynvaroth
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  308
  • Reputation:   3
  • Joined:  12/18/11
  • Last Seen:  

you mean at every 30 (1:30, 2:30, 3:30 etc..) the event start ?

Then replace

    OnClock0030:
    OnClock0130:
    OnClock0230:
    OnClock0330:
    OnClock0430:
    OnClock0530:
    OnClock0630:
    OnClock0730:
    OnClock0830:
    OnClock0930:
    OnClock1030:
    OnClock1130:

by

OnMinute30:// start at every 30 mins of an hour

it will not mess my other event? example they will not run the same time? like poring catcher, jumper and disguise? they will not run at the same time?

 

you mean at every 30 (1:30, 2:30, 3:30 etc..) the event start ?

Then replace

    OnClock0030:
    OnClock0130:
    OnClock0230:
    OnClock0330:
    OnClock0430:
    OnClock0530:
    OnClock0630:
    OnClock0730:
    OnClock0830:
    OnClock0930:
    OnClock1030:
    OnClock1130:

by

OnMinute30:// start at every 30 mins of an hour

it will not mess my other event? example they will not run the same time? like poring catcher, jumper and disguise? they will not run at the same time?

 

I want to make my event dont occur the other events

 

example like this:

 

poring catcher every 15 mins

jumper every 30 mins

disguise every 45 mins

lucky pick every 60 mins

In your example the events will happen at the same time, because, for instance, if the "Poring Catcher" happens every 15 minutes, then it will also happen every 30 minutes...

If you would like to make them happen after each other with a break of 15 minutes, you could do it this way:

"Poring Catcher" happens every full hour:

OnMinute00:
"Jumper" happens at the 15th minute of each hour:
OnMinute15:
"Disguise" happens at the 30th minute of each hour:
OnMinute30:
"Lucky Pick" happens at the 45th minute of each hour:
OnMinute45:
Is this what you need?

they will run only 1 times in every hour? or 2 time in 1 hr like Onminute30 will nut run on consecutive 30mins,  i just want to clarify that. thanks btw

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:  

They will run once each hour in my code.

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