Jump to content

Recommended Posts

Posted

I am looking for a way to fire an event after a specific amount of server ticks have occured. The event is simple, write to a text file. Its part of a much larger idea I have.

 

1. What is the best way to so?

2. Is forge sandboxed in such a way that would prevent me from writing to a raw text file while the game is running? Not a config I am talking about an actual text file on the system.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Posted

Hi

 

If you're running a tick event anyway (ServerTickEvent - have you used Forge (FML) events before?) I would just add a counter.

 

eg

 

tickEvent(ServerTickEvent event)
{
  tickCount++;

  int ticksElapsedSinceTrigger = tickCount - triggerTickCount;
  if (ticksElapsedSinceTrigger >= EVENT_DELAY) {
    // write ye texte file
  }
}

 

I have successfully written text files to the minecraft game directory and saves directory.  Don't know if you can escape outside those.  Probably yes, I imagine.

 

-TGG

Posted

I have not used ticks before. I thought this might be an easy way to implement something simple.

 

Don't I need to subscribe to a Forge Event Handler or something?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Posted

After thinking on my idea a little more I realized it would be a very bad idea to fire as a tick on the server. The idea is to make a "mod" (if you can call it that really) that writes to a text file every (user configurable) half hour. Its a proof concept I have for a small server watcher tool. So this topic was not the right direction for me to go. Still helpful though thanks.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

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