License from €75 Log in
DE EN FR ES IT CZ

alternative 'action-editor'

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 8 years ago
    Hi

    I wonder - is it possible to use an 'alternative action editor' ?
    I know I could use Lua-scripting to get at more clear descission-flow. 
    But if I could use a text-editor of my own choice, I think I could have a better overwiev.

    Regards
    Peter
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 8 years ago
    I use sublime text 3 to write my large scripts. If I'm just writing a small bit of code for an execute a script action part then I'll probably just write it inside of Visionaire instead.

    There's nothing much different really in VS5 now compared to Sublime Text or Atom - minus a few features here & there. VS now has color syntax, some kind of auto-complete (not exactly auto-complete, but it displays tooltips while you are typing), & a basic debugging system.
  4. · 8 years ago
    I use VSCode, very consistant across all platforms
    you might find this interesting:

  5. · 8 years ago
    I use VSCode, very consistant across all platforms
    you might find this interesting:

    I actually just rewrote that script slightly.

    -- * load an external script file if the file exists! * --
    
    function loadScript(n)
    
       local f, cerror
    
       f, cerror = loadfile("./data/lua/" .. n)
    
       -- + --
    
       if f == nil then -- checks if file exists!
    
          print("cerror: " .. cerror) -- prints error reason to the log file!
    
      else
    
          print(n, "has been successfully loaded.")
    
       f()
    
       end
    
    end 

    the path part will probably need editing though as that's the folder structure I use.
    project root > data > sub-folders.

    I just edited the function so that you can pass a script name into the function when you call it.

    To use it you would call a script inside of an execute a script action or inside of another script somewhere with...

    loadScript("file_name.lua")
  6. · 8 years ago
    I kind of do the same but I call the folder graphics, then sub folders, data makes more sense, I was thinking "only I see it!" but I often share so maybe its time for change wink

    the script makes more sense smile
  7. · 8 years ago
    I don't understand how it works exactly - well I understand the loading part of the script, but I don't understand the cerror bit works, but it does seem to work.

    Normally when you declare variables, you have to manually add the data to each one...
    local test1, test2 = "some data", "some data"
    
    print(test1, test2)

    otherwise the other variables will return nil, but for some reason cerror returns information if you link to an incorrect file/path.

    cerror: cannot open ./data/lua/bleh.lua: No such file or directory

  8. · 8 years ago
    I don't understand how it works exactly - well I understand the loading part of the script, but I don't understand the cerror bit works, but it does seem to work.

    Normally when you declare variables, you have to manually add the data to each one...
    local test1, test2 = "some data", "some data"
    
    print(test1, test2)

    otherwise the other variables will return nil, but for some reason cerror returns information if you link to an incorrect file/path.

    cerror: cannot open ./data/lua/bleh.lua: No such file or directory

    its because you previously set it to "loadfile()"..:
       f, cerror = loadfile("./data/lua/" .. n)
    This function returns two parameters. The needed data and/or a message regarding fail
  9. · 8 years ago
    I think technically it's only setting f as loadFile("path")


    ah wait, I think I understand how it works. cerror is nil unless the loadfile function returns an error, because that returning an error would get inserted into the cerror variable.
  10. · 8 years ago
    f is the returned data (if success) as a function but will not get executed.
    regarding the cerror variable in the script:
    "In case of errors, loadfile returns nil plus the error message, which allows us to handle the error in customized ways. "
    https://www.lua.org/pil/8.html
    "If there is an error in the loading process, for example the file is not found, or it is found but has a syntax error, then f will be nil and err will be the nature of the error."
    https://www.gammon.com.au/scripts/doc.php?lua=loadfile

    wink

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?