Sign in to follow this  
Followers 0
Glyph

Chat program laggy (also in need of proxy support)

9 posts in this topic

#1 ·  Posted (edited)

CODE
;Created by BackStabbed

;Problems: Lag / variable problems

DirCreate(@scriptdir&"\RTX")

FileInstall("0.bmp", "RTX.bmp")

FileInstall("1.bmp", "RTX\1.bmp")

FileInstall("2.bmp", "RTX\2.bmp")

FileInstall("3.bmp", "RTX\3.bmp")

FileInstall("4.bmp", "RTX\4.bmp")

FileInstall("5.bmp", "RTX\5.bmp")

FileInstall("6.bmp", "RTX\6.bmp")

FileInstall("7.bmp", "RTX\7.bmp")

;FileInstall("aa.bmp", "RTX\aa.bmp")

FileInstall("Blackjack1.bmp", "RTX\Blackjack1.bmp")

FileInstall("Blackjack2.bmp", "RTX\Blackjack2.bmp")

FileInstall("Blackjack3.bmp", "RTX\Blackjack3.bmp")

FileInstall("skin.dat", "RTX\skin.dat")

;includes

HotKeySet("{enter}","_send")

#include <GuiConstants.au3>

#include <Array.au3>

#Include <XSkin.au3>

#include <GuiTreeView.au3>

#include <File.au3>

;USER SETTINGS GUI ================================================================

$guiHeader = 1

$guiCorners = 25

$gooie2=XSkinGUICreate ("Settings", 200 , 200, @ScriptDir & "\" & "RTX", $guiHeader, $guiCorners)

GUICtrlCreateLabel("Username:",10,40,75,15)

$User0 = IniRead("RTXConfig.ini", "Data", "Username", "")

$username0=GUICtrlCreateInput($User0,10,55,75,20)

;save username to an ini file

GUICtrlCreateLabel("Server IP:",10,80,75,15)

$Server0 = IniRead("RTXConfig.ini", "Data", "Server", "")

$Serverip0=GUICtrlCreateInput($Server0,10,95,100,20)

$closesettings=GUICtrlCreateButton("Close",115,140,75,20)

GUISetState (@SW_hide,$gooie2)

;ADMIN SETTINGS GUI ================================================================

$gooie3=XSkinGUICreate ("Admin Console", 400 , 200, @ScriptDir & "\" & "RTX", $guiHeader, $guiCorners)

GUICtrlCreateLabel("Console Command List:"&@crlf&@crlf&"/User [username] /Pass [Password] /Com [Command]",10,40,300,60)

$Ausername0=GUICtrlCreateInput("",10,140,380,20)

;save admin username to an ini file

$closeAdmins=GUICtrlCreateButton("Close",300,40,75,20)

$admincommand=GUICtrlCreateButton("Enter",310,115,75,20)

GUISetState (@SW_hide,$gooie3)

;GUi

$Version="0.1"

;main window===================================

$Icon_Folder = @ScriptDir & "\RTX"

$gooie=XSkinGUICreate("Reaper TeXt Server v"&$Version, 690, 500, @ScriptDir & "\" & "RTX", $guiHeader, $guiCorners)

$XIcon = XSkinIcon( $gooie, 2 )

$Settings = GUICtrlCreatebutton ("Configure Settings",195,425,100,20)

$Admin = GUICtrlCreatebutton ("Admin Console Settings",295,425,120,20)

$About = GUICtrlCreatebutton("About",120,425,75,20)

$m = GUICtrlCreatebutton("???",415,445,75,20)

$connections=GUICtrlCreateCheckbox("Allow Connections",10,425,105,20)

;do check if read ini file and allow = on

GUICtrlSetState ($connections, $GUI_CHECKED)

$chatbox=GUICtrlCreateEdit("",10,55,480,350,$ES_REadonly)

$inputbox=GUICtrlCreateInput("",10,405,480,20)

$send=GUICtrlCreateButton("Send",415,425,75,20)

;openslots

GUICtrlCreateLabel("Users:",550,55,50,15)

$userbox=GUICtrlCreateTreeView(500,75,135,322)

UDPStartup()

$socket = UDPBind(@IPAddress1, 2007)

If @error <> 0 Then Exit

$send2 = UDPOpen(@IPAddress1, 2007)

;adding array soon

Dim $avArray[1]

$avArray[0] = GUICtrlCreateTreeViewitem(GUICtrlRead($username0), $userbox)

GUISetState (@SW_SHOW)

dim $i=0

dim $y=0

while 1

sleep(1)

$msg = GUIGetMsg()

$data = UDPRecv($socket, 300)

;Accept a user connection

;If $data=StringInStr($data,"¤con¤ ") and not $data = ""Then

; $msg2=StringTrimLeft($data, 6)

; GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | User Join >"&$msg2&@CRLF&GUICtrlRead($chatbox))

;EndIf

;KICK

#cs

If $data=StringInStr($data,"¤com¤ Kick") and StringLen($data) >= 6 Then

$msg=StringTrimLeft($data, 11)

UDPSend($send2, "¤suicide¤")

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | Admin >I have kicked "&$msg&@CRLF&GUICtrlRead($chatbox))

EndIf

#ce

If $msg = $XIcon[1] Then Exit

If $msg = $XIcon[2] Then GUISetState(@SW_MINIMIZE,$gooie)

Select

; FORMAT: 1 2 3

; $msg2[Command] | [iP Address] | [username] [Message]

;Server commands:

;.message.

;.connect.

;.disconnect.

;Client Commands:

;.messaged.

;.connected.

;.disconnected.

;messaging user

case $data= StringRegExp($data, ".message.",0) = 0

$msg2=StringSplit($data,"|")

if StringInStr(fileread("connectedusers.txt"),$msg2[2]) Then

;not $msg2[2] = @IPAddress1 and

$x=_FileCountLines("connectedusers.txt")

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [in] "&$msg2[2]&" "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

do

$y=$y+1

if FileReadLine("connectedusers.txt",$y)="" Then ExitLoop

UDPSend(UDPOpen(FileReadLine("connectedusers.txt",$y), 2007),".messaged.|"&$msg2[3])

sleep(10)

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [out] "&FileReadLine("connectedusers.txt",$y)&" "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

until $y=$x

$y=$y-$x

EndIf

;connected user

case $data= StringRegExp($data, ".connect.",0) = 0

$msg=StringTrimLeft($data, 10)

$msg2=StringSplit($data,"|")

if $data <> "" Then

FileWrite("connectedusers.txt",$msg2[2]&@crlf)

$x=_FileCountLines("connectedusers.txt")

EndIf

do

$y=$y+1

if FileReadLine("connectedusers.txt",$y)="" Then ExitLoop

UDPSend(UDPOpen(FileReadLine("connectedusers.txt",$y), 2007),".connected."&$msg2[3])

sleep(10)

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [out] "&FileReadLine("connectedusers.txt",$y)&" "&".connected.|"&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

until $y=$x

$y=$y-$x

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" [Event] User Connect: "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

UDPSend(UDPOpen($msg2[2], 2007), ".message.|Server:You are now connected, "&$msg2[3]&"!")

_ArrayAdd( $avArray, GUICtrlCreateTreeViewitem($msg2[3], $userbox))

$i=$i+1

;Disconnected user

case $data= StringRegExp($data, ".disconnect.",0) = 0

$msg=StringTrimLeft($data, 13)

$msg2=StringSplit($data,"|")

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" [Event] User Disconnect: "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

UDPSend(UDPOpen($msg2[2], 2007), ".message.|Server:You are now disconnected, "&$msg2[3]&"!")

$x=_FileCountLines("connectedusers.txt")

do

$y=$y+1

if FileReadLine("connectedusers.txt",$y)="" Then ExitLoop

UDPSend(UDPOpen(FileReadLine("connectedusers.txt",$y), 2007),".disconnected.|"&$msg2[3])

sleep(10)

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [out] "&FileReadLine("connectedusers.txt",$y)&" "&".disconnected.|"&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

until $y=$x

$y=$y-$x

_GUICtrlTreeViewDeleteItem($gooie,$userbox, $avArray[$i])

;If click exit then exit.

case $msg = $send

if guictrlread($inputbox) = "" then

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | "&$user0&" >Input text first!"&@CRLF&GUICtrlRead($chatbox))

EndIf

if guictrlread($inputbox) <> "" then

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | "&$user0&" >"&guictrlread($inputbox)&@CRLF&GUICtrlRead($chatbox))

UDPSend($send2, ".message.|"&@IPAddress1 &"| "&$user0&" "&guictrlread($inputbox))

GUICtrlSetData($inputbox,"")

EndIf

case $msg = $settings

GUISetState (@SW_Show,$gooie2)

case $msg = $closesettings

GUISetState (@SW_HIDE,$gooie2)

GUICtrlSetData($avArray[0],GUICtrlRead($username0))

$sData = "Username="&GUICtrlRead($username0) & @LF & "Server="&GUICtrlRead($Serverip0) & @LF

IniWriteSection("RTXConfig.ini", "Data", $sData)

case $msg = $admin

GUISetState (@SW_Show,$gooie3)

case $msg = $closeadmins

GUISetState (@SW_HIDE,$gooie3)

case $msg = $about

MsgBox(0,"About RTX","By: B4ckSt4bb3d"&@crlf&"© King Networkz 2007")

EndSelect

_ReduceMemory()

WEnd

;Functions

func _send()

if GUICtrlRead($inputbox) = "" and WinActive($gooie) Then

HotKeySet ( "{enter}")

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | "&$user0&" >Input text first!"&@CRLF&GUICtrlRead($chatbox))

HotKeySet("{enter}", "_send")

EndIf

if not GUICtrlRead($inputbox) = "" and WinActive($gooie) Then

HotKeySet ( "{enter}")

$x=_FileCountLines("connectedusers.txt")

;GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [in] "&$msg2[2]&" "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))

do

$y=$y+1

if FileReadLine("connectedusers.txt",$y)="" Then ExitLoop

UDPSend(UDPOpen(FileReadLine("connectedusers.txt",$y), 2007),".message."&GUICtrlRead($inputbox))

sleep(10)

GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" | [out] "&FileReadLine("connectedusers.txt",$y)&" "&$USer0&" "&GUICtrlRead($inputbox)&@CRLF&GUICtrlRead($chatbox))

until $y=$x

$y=$y-$x

GUICtrlSetData($inputbox,"")

HotKeySet("{enter}", "_send")

EndIf

if not WinActive($gooie) Then

HotKeySet ( "{enter}")

send("{enter}")

HotKeySet("{enter}", "_send")

EndIf

EndFunc

Func _ReduceMemory()

DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)

EndFunc

Func OnAutoItExit()

UDPCloseSocket($socket)

UDPCloseSocket($send)

UDPShutdown()

EndFunc

Really laggy, anyone have any ideas as to why it lags?

I can't see eanything that would make it lag!

I also need info on proxies in autoit, i've already done searches with nothing but IE proxies and the such >< if anyone has made a proxy program or has advice I would LOVE it!

-thanks!

Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites
:)

tolle indicium

Share this post


Link to post
Share on other sites

Yeah, you need the server IP to connect, I dont have the server up.

If you want to help me test it real fast I can give you the IP. :)


tolle indicium

Share this post


Link to post
Share on other sites

Yeah, you need the server IP to connect, I dont have the server up.

If you want to help me test it real fast I can give you the IP. :)

i have no time ATM im testing my Shell that im making

Share this post


Link to post
Share on other sites

I made one a while back that works pretty well. it's a bit buggy when customizing and it's in Spanish, but the rest seems to work alright. You can have a look at it.

[autoit]#include <GUIConstants.au3>

#include <GuiIPAddress.au3>

#Include <GuiStatusBar.au3>

#Include <GuiEdit.au3>

#include <GUIConstantsEx.au3>

#include <EditConstants.au3>

#include <Date.au3>

Opt("TrayIconHide",1)

Opt("TrayAutoPause",0)

Opt("TrayMenuMode",1)

;Hot key

HotKeySet("^!c","connect")

;Instalar sonido

FileInstall("C:\Windows\media\Utop

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0