Jump to content
  • 0

Time Counter Code


tazerman2

Question

Hello all i am looking for Timer Counter for Event

i want you show in html a time like

 

"Time: 20 : 30 | 20 : 28"

 

i have try to make one and all my try is not work.

no have money but i can make 4 html for community board

or site or npc for this code.

 

if any can help pm tnx

Edited by tazerman2
Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Hello all i am looking for Timer Counter for Event

i want you show in html a time like

 

"Time: 20 : 30 | 20 : 28"

 

i have try to make one and all my try is not work.

no have money but i can make 4 html for community board

or site or npc for this code.

 

if any can help pm tnx

i answered you already in greek section mate. "you want it on dish"?

Link to comment
Share on other sites

  • 0

On which format do you get your time ? ms ? seconds ?

 

If you use aCis latest, you got StringUtil.getTimestamp which return a time formated under "h m s". Time must be on second so simply /1000 if you got ms time.

 

You can also do following on a more universal way. Simply choose the format of your dreams.

new SimpleDateFormat("yyyy-MM-dd HH:mm").format(castle.getSiegeDate().getTimeInMillis())
Edited by Tryskell
Link to comment
Share on other sites

  • 0

tnx tryskell your info help

is working show the time all good and the time is countdown but

i dont know why is dont take the time from my event

 

here is the code:

 

npc.java

		
long time;
time = RandomFight.getInstance().getTime();
String PARENT_DIR = "data/html/mods/MiniEvent/menu.htm";
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(PARENT_DIR);
html.replace("%objectId%", String.valueOf(getObjectId()));
html.replace("%timer%", String.valueOf("Time: " + new SimpleDateFormat("mm:ss").format(time)));
player.sendPacket(html);

Event.java

	private static int Time = Config.EVERY_MINUTES;

/**
	 * @return
	 */
	public long getTime()
	{
		return Time - System.currentTimeMillis();
	}
Link to comment
Share on other sites

  • 0

On which base the timer is calculated ? Store the time on the event, and then you can retrieve it. _launchTime, getter/setter, set it when threadpool is setuped, get it when you need it. Refresh it (set it) when you launch back the event.

Link to comment
Share on other sites

  • 0

PS : if you retrieve the time from sql simply store it directly on event while server loading, and then refresh it when you threadpool the event again.

Link to comment
Share on other sites

  • 0

It can't work with this writing style, you have to rewrite few parts to be able to handle it.

 

I must add your event currently run every Xmin but the start depends about your server launching time. So event can be 18h06:30sec, then 18h26:30sec (if you picked 20min), etc etc. Which is shitty way to handle an event, as you can't even rely properly on the hour.

 

Use global task system to care about launching time, that way you can also retrieve easily the next launching time. Atm you can't find it (or maybe _task.getDelay() if you store the task, but it's clunky).

Link to comment
Share on other sites

  • 0

i answered you already in greek section mate. "you want it on dish"?

eisai sobaros twra ? h apantisi poy toy edoses sto elliniko section opos les itan telios theoritiki ( kai monos toy mporoyse na to skeyti ayto poy toy eipes sigoyra den xriazotan help gia ayto )

h apantisi toy Tryskell einai pio olokliromeni kai theoritika kai praktika 

 

san L2J Dev pleon sto maxcheater mipos eprepe na dinis pio siggekrimenes apantisis ?

h se kanane gia na exeis diaforetiko color name ? kai na min boithas stin ousia

Link to comment
Share on other sites

  • 0

eisai sobaros twra ? h apantisi poy toy edoses sto elliniko section opos les itan telios theoritiki ( kai monos toy mporoyse na to skeyti ayto poy toy eipes sigoyra den xriazotan help gia ayto )

h apantisi toy Tryskell einai pio olokliromeni kai theoritika kai praktika 

 

san L2J Dev pleon sto maxcheater mipos eprepe na dinis pio siggekrimenes apantisis ?

h se kanane gia na exeis diaforetiko color name ? kai na min boithas stin ousia

ok

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • rename the l2.bin into l2.exe
    • L2LIVE.PRO- Dynamic Mid-rates Essence Seven Signs GRAND OPENING - July 5, 20:00 GMT+3 (EEST) TEST SERVER IS OPEN - COME AND CHECK IT OUT TODAY! Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu   Server description * EXP/SP: Dynamic (x1- x100 based on your level, *before* Sayha and EXP buffs * Adena: x50 / Item Drop: x10 / Fishing EXP increased / Attribute EXP increased * Simplified gameplay to stay in the loop while not spending hours and hours farming * Starter Pack containing very useful items for beginners * MP replenishing potions with auto-consumption * No overpowered donations L2LIVE shop * All spellbook coupons, pet spellbook coupons and master books are sold via Game Assistant * Additionally you can buy SP pouches, enchanted talismans, pet training guides and various other consumables for Adena and L-Coin * More items such as cloaks, more talismans, agathions, belts, pendants, enchantment scrolls of various grades, evolution stones, etc will be added! Shop server as a shortcut, and all retail-like ways of earning items are still here! L-Coins * Drops with small change and in random amounts from Lv60+ monsters  * All raidbosses drop random amount of L-Coin Pouches generating up to 420 Lcoin per unit. **Grand Olympiad and Events** * Grand Olympiad is held week day * Format is 1v1, unlimited weekly fights  * Heroes are declared weekly at Sunday * There are three automated events - TvT, CTF and Deathmatch, running at evenings * Orc Fortress, Battle with Balok, Keber Hunter, Archievements Box, Daily Gift Calendar provisional events are active too Custom user commands * .offlineplay command, your character will keep playing till death or server restart * .offlineshop command, keeps your shop sitting until all items are purchased * .apon / .apoff - enable/disable HP/MP autoconsume And lots of other small improvements are waiting for you!   Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu
  • Topics

×
×
  • Create New...