Forums

Latest Neocron News and Information

New Program - NC TOOL

For all discussion about the Neocron 2 world.

Moderator: Tech Haven Network - Moderator team

New Program - NC TOOL

Postby Syntax-Error » Fri Jun 04, 2004 7:15 pm

Only the first section, and this is only for those who are intrested in the code itself. pretty simple program for setting up the RPOS colour ( i know the .ini isnt the right one. that will be set later )


Code: Select all
Dim colour As String
Dim red As String
Dim blue As String
Dim green As String
Dim allcolour As String

Private Sub cmd_rposexit_Click()
frm_rpos.Visible = False
frm_main.Visible = True
End Sub

Private Sub cmd_rposreset_Click()
SHP_colour.BackColor = RGB(0, 0, 0)
HSB_Red.Value = 0
HSB_Green.Value = 0
HSB_Blue.Value = 0
End Sub

Private Sub cmd_write_Click()
Dim x            As Long
Dim sSection     As String
Dim sEntry       As String
Dim sString      As String
Dim sFileName    As String

allcolour = red$ & " " & green$ & " " & blue$ & " " & 255

sSection$ = "DEFAULT"
sEntry$ = colour$
sString$ = allcolour$
sFileName$ = "c:\sample.ini"


x = WritePrivateProfileString(sSection$, sEntry$, sString$, sFileName$)

If x Then
     MsgBox "Setting has been saved"
Else
     MsgBox "Error saving setting"
End If

End Sub

Private Sub Form_Load()
frm_rpos.Top = 0
frm_rpos.Left = 0
End Sub

Private Sub HSB_Blue_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub HSB_Green_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub HSB_Red_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub opt_rpos_Click(Index As Integer)
Select Case Index

Case 0
colour$ = "Default"
Case 1
colour$ = "DefaultText"
Case 2
colour$ = "DefaultTextEffect"
Case 3
colour$ = "SysMessages"
Case 4
colour$ = "GameMessages"
Case 5
colour$ = "LocalChat"
Case 6
colour$ = "GlobalChat"
Case 7
colour$ = "TeamChat"
Case 8
colour$ = "DirectChat"
Case 9
colour$ = "Player"
Case 10
colour$ = "PlayerNoPK"
Case 11
colour$ = "CharSysWarning"
Case 12
colour$ = "CharSysBonus"
Case 13
colour$ = "CharSysCritical"
Case 14
colour$ = "ContextActive"
Case 15
colour$ = "ContextNoActive"
Case 16
colour$ = "ContextDisabled"
Case 17
colour$ = "HighlightText"
Case 18
colour$ = "HighlightBackground"
Case 19
colour$ = "Item"
Case 20
colour$ = "ItemDisabled"
Case 21
colour$ = "ItemNotUsable"
Case 22
colour$ = "GoodSoullight"
Case 23
colour$ = "NeutralSoullight"
Case 24
colour$ = "BadSoullight"
Case 25
colour$ = "Damage"
Case 26
colour$ = "Heal"

End Select
End Sub
Since wars begin in the minds of men, it is in the minds of men that the defence of peace must be constructed.
- UNESCO Constitution
User avatar
Syntax-Error
THN Supahfan
 
Posts: 254
Joined: Wed Aug 20, 2003 9:35 am

Postby HusK » Fri Jun 04, 2004 7:48 pm

I'm not sure what programing language your using to build this code... almost looks like your implementing it into neocron itself....
User avatar
HusK
THN Whore
 
Posts: 1385
Joined: Thu Aug 21, 2003 8:19 pm
Location: Holland

Postby Morpheous » Fri Jun 04, 2004 10:42 pm

VB code, any chance we could get the App? :p
User avatar
Morpheous
THN Addicted
 
Posts: 735
Joined: Tue Oct 07, 2003 6:30 am
Location: UK, Oxfordshire

Postby Brammers » Sat Jun 05, 2004 9:09 am

Now that I understand what you are doing...

1. Put all the colours into an array...eg

Dim sColours as string()

sColour(0) = "Default"
sColour(1) = "DefaultText"

...etc

And to get the colour replace all those case statements.

colour=sColour(Index)

Also why are youn using the $ at the end of variables? You dont need it in VB.
Brammers - THN Admin & CEO Phoenix Ltd.
Image
User avatar
Brammers
THN Lead Administrator
 
Posts: 4036
Joined: Tue Aug 19, 2003 9:49 am
Location: Phoenix Ltd: CEO office
Clan: Phoenix Ltd
Faction: Fallen Angels

Postby HusK » Sat Jun 05, 2004 11:07 am

VB? arg fuck that, sorry not gonna bother then (NFI) decided a long time ago I'd never wanted anything to do with that piece of crap script language (again NFI to you)

Perhaps you can move into something more appropiate ? :x
Java would be nice, could run it as web app then to.
User avatar
HusK
THN Whore
 
Posts: 1385
Joined: Thu Aug 21, 2003 8:19 pm
Location: Holland

Postby booglebox » Sat Jun 05, 2004 3:22 pm

don't bother with code shit use applescrpts ::cheers::
"There is no signature"

My b-day on the 6/11!
booglebox
THN Supahfan
 
Posts: 410
Joined: Mon Mar 08, 2004 1:12 pm
Location: France

Postby Syntax-Error » Sat Jun 05, 2004 4:57 pm

Well i have a level 3 in visual basic. so it will be written in visual basic, the app will be ready soon. this is basically just for me to learn.
Since wars begin in the minds of men, it is in the minds of men that the defence of peace must be constructed.
- UNESCO Constitution
User avatar
Syntax-Error
THN Supahfan
 
Posts: 254
Joined: Wed Aug 20, 2003 9:35 am

Postby Archeus » Tue Jun 08, 2004 12:47 pm

Brammers wrote:Also why are youn using the $ at the end of variables? You dont need it in VB.


Its a good coding convention for VB, if your not using polish notation (eg. strColorText or sColorText). Although after looking it appears half of it is in polish notation and the rest isn't.

Also throw in an "option explicit".

Your right about the case statement. Not nice way to do it. Personally I'd put the number code and text out to an ini file as well. That way someone else could localise the program without having to edit the code.
Archeus
THN fan
 
Posts: 205
Joined: Thu Nov 06, 2003 8:42 am

Postby Syntax-Error » Tue Jun 08, 2004 6:31 pm

Well theres a module or infact two stuck on the side of that here is the full code. not working just yet fully due to a bug in my code. just i have no reason to fix it right now.

MODULE 1

Code: Select all
' The following module uses API functions available in kernel32
' to interact with specified files

Public Declare Function GetPrivateProfileSection Lib "Kernel32" _
    Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, _
    ByVal lpReturnedString As String, ByVal nSize As Long, _
    ByVal lpFileName As String) As Long
    ' Get the section from the INI file
    ' lpAppName refers to the section in the INI file
    ' lpReturnedString refers to the retrieved string
    ' nSize refers to the size of retrieved string
    ' lpFileName refers to the INI file

Public Declare Function GetPrivateProfileString Lib "Kernel32" _
   Alias "GetPrivateProfileStringA" (ByVal lpApplicationName _
   As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
    ByVal lpReturnedString As String, ByVal nSize As Long, _
    ByVal lpFileName As String) As Long
    ' Gets the settings from INI file
    ' lpApplicationName refers to the section in the INI file
    ' lpKeyName refers to the key we wish to change
    ' lpDefault refers to the value the key takes if no value is entered for it
    ' lpReturnedString refers to the retrieved string
    ' nSize refers to the size of retrieved string
    ' lpFileName refers to the INI file

Public Declare Function WritePrivateProfileSection Lib "Kernel32" _
    Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, _
    ByVal lpString As String, ByVal lpFileName As String) As Long
    ' Writes the section to the INI file
    ' lpAppName refers to the section in the INI file
    ' lpString refers to the string being written
    ' lpFileName refers to the INI file
   
Public Declare Function WritePrivateProfileString Lib "Kernel32" _
    Alias "WritePrivateProfileStringA" (ByVal lpApplicationName _
    As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
    ByVal lpFileName As String) As Long
    ' Writes the settings to the INI file
    ' lpApplicationName refers to the section in the INI file
    ' lpKeyName refers to the Key being written to
    ' lpString refers to the value being written to the specified Key
    ' lpFileName refers to the INI file
   
    'Public gstrKeyValue As String * 256

Public path As String


MODULE 2

Code: Select all
Option Explicit

Private Type BrowseInfo
    lngHwnd        As Long
    pIDLRoot       As Long
    pszDisplayName As Long
    lpszTitle      As Long
    ulFlags        As Long
    lpfnCallback   As Long
    lParam         As Long
    iImage         As Long
End Type

Private Const BIF_RETURNONLYFSDIRS = 1
Private Const MAX_PATH = 260

Private Declare Sub CoTaskMemFree Lib "ole32.dll" _
    (ByVal hMem As Long)

Private Declare Function lstrcat Lib "Kernel32" _
   Alias "lstrcatA" (ByVal lpString1 As String, _
   ByVal lpString2 As String) As Long
   
Private Declare Function SHBrowseForFolder Lib "shell32" _
   (lpbi As BrowseInfo) As Long
   
Private Declare Function SHGetPathFromIDList Lib "shell32" _
   (ByVal pidList As Long, ByVal lpBuffer As String) As Long


Public Function BrowseForFolder(ByVal lngHwnd As Long, ByVal strPrompt As String) As String

    On Error GoTo ehBrowseForFolder 'Trap for errors

    Dim intNull As Integer
    Dim lngIDList As Long, lngResult As Long
    Dim strpath As String
    Dim udtBI As BrowseInfo

    'Set API properties (housed in a UDT)
    With udtBI
        .lngHwnd = lngHwnd
        .lpszTitle = lstrcat(strPrompt, "")
        .ulFlags = BIF_RETURNONLYFSDIRS
    End With

    'Display the browse folder...
    lngIDList = SHBrowseForFolder(udtBI)

    If lngIDList <> 0 Then
        'Create string of nulls so it will fill in with the path
        strpath = String(MAX_PATH, 0)

        'Retrieves the path selected, places in the null
         'character filled string
        lngResult = SHGetPathFromIDList(lngIDList, strpath)

        'Frees memory
        Call CoTaskMemFree(lngIDList)

        'Find the first instance of a null character,
         'so we can get just the path
        intNull = InStr(strpath, vbNullChar)
        'Greater than 0 means the path exists...
        If intNull > 0 Then
            'Set the value
            strpath = Left(strpath, intNull - 1)
        End If
    End If

    'Return the path name
    BrowseForFolder = strpath
    Exit Function 'Abort

ehBrowseForFolder:

    'Return no value
    BrowseForFolder = Empty

End Function


frm_main
Code: Select all
Private Sub cmd_options_Click()
frm_options.Visible = True
frm_main.Visible = False
End Sub

Private Sub cmd_quit_Click()

End

End Sub

Private Sub cmd_rpos_Click()

frm_rpos.Visible = True
frm_main.Visible = False

End Sub


frm_rpos

Code: Select all
Dim colour As String
Dim red As String
Dim blue As String
Dim green As String
Dim allcolour As String
Dim inipath As String

Private Sub cmd_rposexit_Click()
frm_rpos.Visible = False
frm_main.Visible = True
End Sub

Private Sub cmd_rposreset_Click()
SHP_colour.BackColor = RGB(0, 0, 0)
HSB_Red.Value = 0
HSB_Green.Value = 0
HSB_Blue.Value = 0
End Sub

Private Sub cmd_write_Click()
Dim x            As Long
Dim sSection     As String
Dim sEntry       As String
Dim sString      As String
Dim sFileName    As String

allcolour = red$ & " " & green$ & " " & blue$ & " " & 255
inipath = strpath$ & "\ ini \ rposcolor.ini"
sSection$ = "DEFAULT"
sEntry$ = colour$
sString$ = allcolour$
sFileName$ = inipath


x = WritePrivateProfileString(sSection$, sEntry$, sString$, sFileName$)

If x Then
     MsgBox "Setting has been saved"
Else
     MsgBox "Error saving setting"
End If

End Sub

Private Sub Form_Load()
frm_rpos.Top = 0
frm_rpos.Left = 0
End Sub

Private Sub HSB_Blue_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub HSB_Green_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub HSB_Red_Change()
SHP_colour.BackColor = RGB(HSB_Red.Value, HSB_Green.Value, HSB_Blue.Value)
red$ = HSB_Red.Value
green$ = HSB_Green.Value
blue$ = HSB_Blue.Value
End Sub

Private Sub opt_rpos_Click(Index As Integer)
Select Case Index

Case 0
colour$ = "Default"
Case 1
colour$ = "DefaultText"
Case 2
colour$ = "DefaultTextEffect"
Case 3
colour$ = "SysMessages"
Case 4
colour$ = "GameMessages"
Case 5
colour$ = "LocalChat"
Case 6
colour$ = "GlobalChat"
Case 7
colour$ = "TeamChat"
Case 8
colour$ = "DirectChat"
Case 9
colour$ = "Player"
Case 10
colour$ = "PlayerNoPK"
Case 11
colour$ = "CharSysWarning"
Case 12
colour$ = "CharSysBonus"
Case 13
colour$ = "CharSysCritical"
Case 14
colour$ = "ContextActive"
Case 15
colour$ = "ContextNoActive"
Case 16
colour$ = "ContextDisabled"
Case 17
colour$ = "HighlightText"
Case 18
colour$ = "HighlightBackground"
Case 19
colour$ = "Item"
Case 20
colour$ = "ItemDisabled"
Case 21
colour$ = "ItemNotUsable"
Case 22
colour$ = "GoodSoullight"
Case 23
colour$ = "NeutralSoullight"
Case 24
colour$ = "BadSoullight"
Case 25
colour$ = "Damage"
Case 26
colour$ = "Heal"

End Select
End Sub


frm_options

Code: Select all
Public strpath As String
Private Sub cmd_browse_Click()
strpath = BrowseForFolder(Me.hWnd, "Locate Neocron Directory")
txt_path.Text = strpath
End Sub

Private Sub cmd_exit_Click()
frm_options.Visible = False
frm_main.Visible = True
End Sub

Private Sub Command1_Click()
Dim sSection     As String
Dim sEntry       As String
Dim sString      As String
Dim sFileName    As String

inipath = strpath$ & "/neocron.ini"
sSection$ = ""
sEntry$ = NOSPLASH
sString$ = "True"
sFileName$ = inipath

inipath = strpath$ & "/neocron.ini"
sSection$ = ""
sEntry$ = NOEXTRO
sString$ = "True"
sFileName$ = inipath

End Sub
Since wars begin in the minds of men, it is in the minds of men that the defence of peace must be constructed.
- UNESCO Constitution
User avatar
Syntax-Error
THN Supahfan
 
Posts: 254
Joined: Wed Aug 20, 2003 9:35 am

Postby HusK » Wed Jun 09, 2004 11:00 am

love to get it working but as I said, I'm not touching vb(s) :p

anyone wanna do the honor? besides the language itself it looks intresting enough and since syn won't be returning to neocron (...with a pitty excuse I must add :p) somebody else would need to get it done instead :/
User avatar
HusK
THN Whore
 
Posts: 1385
Joined: Thu Aug 21, 2003 8:19 pm
Location: Holland

Postby Archeus » Wed Jun 09, 2004 11:49 am

Archeus
THN fan
 
Posts: 205
Joined: Thu Nov 06, 2003 8:42 am

Postby Syntax-Error » Wed Jun 09, 2004 6:40 pm

like i said done for myself, for my own reasons there are about 5-6 already about. but thats not why i did it. and i still play neocron on another server under another name. with my true friends. but after all the bullshit i have no heart to carry on here.
Since wars begin in the minds of men, it is in the minds of men that the defence of peace must be constructed.
- UNESCO Constitution
User avatar
Syntax-Error
THN Supahfan
 
Posts: 254
Joined: Wed Aug 20, 2003 9:35 am

Postby booglebox » Thu Jun 10, 2004 10:16 am

I have abslutely no intrest in programming whatsoever. I pay peeps to do it for me. i'll just shut up.
"There is no signature"

My b-day on the 6/11!
booglebox
THN Supahfan
 
Posts: 410
Joined: Mon Mar 08, 2004 1:12 pm
Location: France


Return to Tech Haven Sector 2

Who is online

Users browsing this forum: No registered users and 6 guests