IPB

Welcome Guest ( Log In | Register )

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 
Reply to this topicStart new topic
> Convert Access, For 2.6 to 2.7 conversion
AwaKening
post Apr 17 2009, 11:31 PM
Post #1


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



Simple but useful. Just thought I'd share this for others to help make your 2.6 to 2.7 conversion more pleasant.

Simply type /convertaccess internally and it will check your access.ini file and set your commands in the new Command Manager (xml) accordingly. Disregard the following ignorant post by Call.

CODE
'caccess
'1.00
'&Convert Access v1.00:AwaKening
'&convertaccess (Internal Use Only)
'&
'&Use to apply access.ini settings from Stealthbot 2.6 to the new system in 2.7

'// Anything set to this number or higher will result in the command being disabled
Const caccess_Disable = 1001


Sub caccess_Event_PressedEnter(Text)
    If LCase(Text) <> "/convertaccess" Then Exit Sub

    Dim File, objFSO, line, lines, cmd, rank

    VetoThisMessage
    AddChat vbYellow, "CONVERTING ACCESS, please be patient.."
    AddChat vbYellow, "    -Be Sure to click (Continue) if prompted."

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set File = objFSO.OpenTextFile(BotPath & "access.ini", 1, True)
    lines = Split(File.ReadAll, vbCrlf)
    File.Close

    For Each line in Lines
        If InStr(line, "=")>0 Then
            cmd = Split(line, "=")(0)
            rank = Split(line, "=")(1)
            Call AccessUpdate(cmd, rank)
        End If
    Next

    Addchat vbYellow, "Successfully updated Command Access Levels!"

    Set File = Nothing
    Set objFSO = Nothing
End Sub

Private Sub AccessUpdate(command, rank)
    Dim cmd
    Set cmd = OpenCommand(command)
    If IsNumeric(rank) Then
        rank = cInt(rank)
        If rank>=caccess_Disable AND cmd.IsEnabled Then
            cmd.IsEnabled = False
            AddChat vbOrange, command& " Disabled"
        ElseIf cmd.RequiredRank<>rank AND rank<caccess_Disable Then
            cmd.IsEnabled = True
            cmd.RequiredRank = rank
            Addchat vbCyan, "Changed Access: " & command & " = " & rank
        Else
            AddChat vbGreen, "No Change:  " &command
        End If
    Else
        rank = UCase(rank)
        If UCase(cmd.RequiredFlag) <> rank Then
            cmd.RequiredFlag = rank
            Addchat vbBlue, "Changed Flag: " & command & " = " & rank
        Else
            AddChat vbGreen, "No Change:  " &command
        End If
    End If
    cmd.Save
    Set cmd = Nothing
End Sub



Script Format:

CODE
'// Anything set to this number or higher will result in the command being disabled
Const cmd_Disable = 1001

Private Const ForReading = 1

Script("Name") = "ConvertAccess"
Script("Author") = "AwaKening"
Script("Major") = 1
Script("Minor") = 0
Script("Revision") = 0


Sub Event_PressedEnter(Text)
    If LCase(Text) <> "/convertaccess" Then Exit Sub

    Dim File, objFSO, line, lines, cmd, rank

    VetoThisMessage
    AddChat vbYellow, "CONVERTING ACCESS, please be patient.."
    AddChat vbYellow, "    -Be Sure to click (Continue) if prompted."

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set File = objFSO.OpenTextFile(BotPath & "access.ini", 1, True)
    lines = Split(File.ReadAll, vbCrlf)
    File.Close

    For Each line in Lines
        If InStr(line, "=")>0 Then
            cmd = Split(line, "=")(0)
            rank = Split(line, "=")(1)
            Call AccessUpdate(cmd, rank)
        End If
    Next

    Addchat vbYellow, "Successfully updated Command Access Levels!"

    Set File = Nothing
    Set objFSO = Nothing
End Sub

Private Sub AccessUpdate(command, rank)
    Dim cmd
    Set cmd = OpenCommand(command)
    If IsNumeric(rank) Then
        rank = cInt(rank)
        If rank>=cmd_Disable AND cmd.IsEnabled Then
            cmd.IsEnabled = False
            AddChat vbOrange, command& " Disabled"
        ElseIf cmd.RequiredRank<>rank AND rank<cmd_Disable Then
            cmd.IsEnabled = True
            cmd.RequiredRank = rank
            Addchat vbCyan, "Changed Access: " & command & " = " & rank
        Else
            AddChat vbGreen, "No Change:  " &command
        End If
    Else
        rank = UCase(rank)
        If UCase(cmd.RequiredFlag) <> rank Then
            cmd.RequiredFlag = rank
            Addchat vbBlue, "Changed Flag: " & command & " = " & rank
        Else
            AddChat vbGreen, "No Change:  " &command
        End If
    End If
    cmd.Save
    Set cmd = Nothing
End Sub


This post has been edited by AwaKening: Apr 23 2009, 10:11 PM


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Call
post Apr 18 2009, 12:51 AM
Post #2


Posting God
*****

Group: Beta Testers
Posts: 1,423
Joined: 15-June 08
From: Denmark, Copenhagen
Member No.: 38,127



1. 2.7 don't have access.ini
2. The-Black-Ninja already did this easy script
3. I Believe The-Black-Ninja got a better outcome..
4. Suggestion you to make something new instead of old..
5. GetConfigEntry + WriteConfigEntry can do this simply..

This post has been edited by Call: Apr 18 2009, 12:53 AM


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Snap
post Apr 18 2009, 02:18 AM
Post #3


The following post is supplementry information
*****

Group: Global Moderators
Posts: 2,922
Joined: 29-January 06
From: Eugene Oregon
Member No.: 31



@Call
1. This is converting 2.6's access.ini's set access overrides and maintaining them to 2.7 CommandsXML.
2. O rly?
3. O rly?
4. See 1, 2 and 3.
5. I was thinking about this, and realized I've forgotten the method used to list all elements within a [section] in a config file -- i know there's a way.. (As this would be required for what he's doin)

I presumed this would be done with the installer - - but it might be forgotten, and still good for those switching to the Beta now.


--------------------
~Life is all busy and stuff right now. - Car accident, lots of dr. appointments... Other stuff too. I still <3 StealthBot.net - - I'll be around.
Thinking about PMing me? Post it instead! CCX Forums | SnapNJacks Trivia Forums
IPB Image
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
AwaKening
post Apr 18 2009, 09:22 AM
Post #4


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



Saves you a bit of time if you have a lot of command access changes like I do. Eric had mentioned in Release 36 I think it was, that he would implement WriteConfigEntry back into beta for command access, but he apparently took it back out or did something wrong because it hasn't been working. This would eliminate the need for it anyway.

@Call
Read the 2.7 changelogs or test some things, because every one of your arguments were ignorant. Try to know what you're talking about before you taint my thread.

This post has been edited by AwaKening: Apr 18 2009, 09:26 AM


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 9th December 2019 - 09:29 AM
Skin by Andrea
Website Legal Information | Hosted by LunarPages