Colex

In-Game Script Editor v0.2

Recommended Posts

Guest
@DeveloperXX

Yes, it worked.... I can edit my scripts, save them and reload (I can also open by the File Browser).

If you are not being able to use it, try adding the "resource.ScriptEditor" in the admin group!

Yours,

Colex

Where to put it?In ACL file? Dude DM was released 3 days ago.I don't think what all ppls understand where to put it.You better make an example.

Share this post


Link to post

Okay

Open the acl.xml ad find this group:

now after this line: and this one

Share this post


Link to post

I did what you said above, now it shows my lua file but when i try to load it says in server log ERROR: unable to fileOpen; unable to open file...

Share this post


Link to post

first of all I'd like to tell ya, great job! :) it certainly stops your headache when you can't run the game in window mode. I'd also have a few suggestions:

  • you disable MTA controls (toggleAllControls) when the editor is showing because pressing certain keys, like 't' for chatbox makes typing really hard
  • bind the editor to a key for easier access (shouldn't be a problem)
  • and one thing that would be really neat, line numbers, would be useful when you're debugging and you're trying to find the bad argument at line 1069 P:

keep up the good work! ;)

EDIT: regarding the first 2 suggestions, if somebody wants to update their script, just replace this function in the ScriptEditor.lua file:

local createEditor = function() 
  if not(editorWindow) then --Constructor    
    toggleAllControls ( false, false, true ) -- or toggleAllControls ( false, true, true ), I don't think it makes any difference though 
    editorWindow = guiCreateWindow(0.2, 0.2, HEIGHT, WIDTH, "In-Game Script Editor", true) 
    guiCreateLabel(0.05, 0.06, 1, 1, "Script Path:", true, editorWindow) 
    editPath = guiCreateEdit(0.04, 0.1, 0.6, 0.08, INITIAL_DIR, true, editorWindow) 
    local openBtn   = guiCreateButton(0.75, 0.1, 0.2, 0.1, "Load Script", true, editorWindow) 
    local dialogBtn = guiCreateButton(0.65, 0.1, 0.1, 0.1, "...", true, editorWindow) 
    scriptBox = guiCreateMemo(0.02, 0.26, 0.96, 0.55, "", true, editorWindow)  
    local reloadBtn = guiCreateButton(0.75, 0.88, 0.2, 0.1, "Save & Reload", true, editorWindow) 
    local saveBtn   = guiCreateButton(0.50, 0.88, 0.2, 0.1, "Save Script", true, editorWindow) 
    addEventHandler("onClientGUIClick", reloadBtn, reloadScript) 
    addEventHandler("onClientGUIClick", saveBtn, saveScript) 
    addEventHandler("onClientGUIClick", openBtn, openScript) 
    addEventHandler("onClientGUIClick", dialogBtn, toogleDialog) 
    bindKey("F1", "down", scriptInput)        
    createDialog() 
    showCursor(true) 
  else --Show/Hide 
    toggleAllControls ( true ) 
    showCursor(not(guiGetVisible(editorWindow))) 
    guiSetVisible(editorWindow, not(guiGetVisible(editorWindow))) 
    guiSetVisible(dialog.window, false) 
  end 
end 

bound the f4 key to show/hide the editor:

bindKey ( "f4", "down", createEditor ) 

Share this post


Link to post

Very nice script, Ive had this since it was released but only recently realised how helpful it could be. Its been particularly useful when doing tricky things that require lots of small changes (often only changing 1 number, ie: making some form of GUI) where constantly minimizing would be a pain, so the ability to make on the spot changes to scripts without needing to leave the server is very handy

For anyone interested, ive modified this script quite heavily over the past few days

screenshots

http://irc-lords.com/~r3mp/ScriptEditor ... en0105.png

http://irc-lords.com/~r3mp/ScriptEditor ... en0106.png

http://irc-lords.com/~r3mp/ScriptEditor ... en0107.png

code available here

Share this post


Link to post

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

  • Recently Browsing   0 members

    No registered users viewing this page.