Jump to content

Getting information from my MinecraftServer


jWalker
 Share

Recommended Posts

Hey i have a minecraftserver for me and my friends.

It's hosted on my PC and now i want to write a gui for it.

So i can easily teleport to someone or set the gamemode etc.

;MCSERVER
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 449, 393, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
$Button1 = GUICtrlCreateButton("Button1", 384, 408, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 8, 408, 369, 21)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$path = "C:\Users\Danny\AppData\Roaming\.minecraft\mcserver"
$minecraftserver = Run(@ComSpec & " /C java -Xms512M -Xmx1024M -jar minecraft_server.jar nogui", $path, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD )
While 1
$dataout = StdoutRead( $minecraftserver )
If $dataout <> "" Then
  $log = FileOpen($path & "\MClog.dat", 9)
  FileWrite($log, $dataout)
  FileClose($log)
  $log = FileOpen($path & "\MClog.dat")
  $logtext = FileRead($log)
  FileClose($log)
  GUICtrlSetData($Edit1, $logtext)
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   StdinWrite( $minecraftserver, "stop" )
   Exit
EndSwitch
WEnd

At First i just want to Add Text and Read text.

Adding text to the program works, On the Gui Event Close section is a part of the code which stops the server.

It works.

A Server output at the start usually looks like this:

177 recipes
27 achievements
2012-02-29 08:21:31 [INFO] Starting minecraft server version 12w08a
2012-02-29 08:21:31 [INFO] Loading properties
2012-02-29 08:21:31 [INFO] Starting Minecraft server on *:25565
2012-02-29 08:21:31 [INFO] Preparing level "world2"
2012-02-29 08:21:31 [INFO] Default game type: 0
2012-02-29 08:21:31 [INFO] Preparing start region for level 0
2012-02-29 08:21:32 [INFO] Done (730407150ns)! For help, type "help" or "?"

All i get from StdOutRead is just 177 recipes and 27 achievements.

The rest of this Output is in the Autoit Console oO

Any ideas what i am doing wrong here?

Link to comment
Share on other sites

Okay next Problem

I used StdErrRead in addition and it works.

But not like a charm.

This part:

2012-02-29 08:21:31 [INFO] Starting minecraft server version 12w08a
2012-02-29 08:21:31 [INFO] Loading properties
2012-02-29 08:21:31 [INFO] Starting Minecraft server on *:25565
2012-02-29 08:21:31 [INFO] Preparing level "world2"
2012-02-29 08:21:31 [INFO] Default game type: 0
2012-02-29 08:21:31 [INFO] Preparing start region for level 0
2012-02-29 08:21:32 [INFO] Done (730407150ns)! For help, type "help" or "?"

looks like this:

2012-02-29 08:21:31 [INFO] Starting minecraft server version 12w08a2012-02-29 08:21:31 [INFO] Loading properties2012-02-29 08:21:31 [INFO] Starting Minecraft server on *:255652012-02-29 08:21:31 [INFO] Preparing level "world2"2012-02-29 08:21:31 [INFO] Default game type: 02012-02-29 08:21:31 [INFO] Preparing start region for level 02012-02-29 08:21:32 [INFO] Done (730407150ns)! For help, type "help" or "?"

I think that these Infos come too fast. Any way to avoid that?

Link to comment
Share on other sites

  • Moderators

jWalker,

I am locking this thread until I get advice from another Mod who is into gaming as to whether it infringes our Forum rules. Apologies for the inconvenience if it is subsequently deemed legal. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...