Scripts / starter questions

Author
Message
Bloodknight
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 10th Jan 2016 23:17
ok, so reading through a few files after reading the docs, and most of it seems fairly straight forward (that said does anybody have a link to a lua editor that supports astyle or other lua code formatting to fix the formatting of a few files/sections).

i see this
-- LUA Script - precede every function and global member with lowercase name of script
at the top of every file, i assume this has something to do with conflicts, as well as knowing where globals are defined and initialised.

yet as soon as i start looking into how the AI works, this rule is violated left right and center




Also most of these possibly all are created but not initialised (not sure how lua manages memory) in global.lua. I also notice that only 3 out of the more thna a dozen or so ai scripts are copies to my standalone sample (using mountain stroll as my test base for the time being btw) so not entirely sure whether this apparent violation of the rule is valid because of declaration in global.lua or because its a 'core' script and the rules are only for new/user scripts.

either way i'm a little confused so i defo could use some clarification if only for my own sanity
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Jan 2016 00:18 Edited at: 11th Jan 2016 00:21
the rule is referring to these parts
function ai_cover_init(e)
function ai_cover_main(e)
being the same as the script name (in this case ai_cover.lua)

there's no issue with what you call variables but it's best not to use a local that is already a global (i think the global overrides the local if i remember correctly)

global variables can be defined anywhere now (originally not)
a standalone will only include scripts in use by the map(s)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Bloodknight
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 11th Jan 2016 02:03
ok, so i can ignore the part about prefixing global variables with the script name, i guess that runs along side what those two ai scripts do, and the rest i assume follow the old rules just because they were written when the rule is in place, fair enough

now i just need to figure out where the main data is hidden and how to access *everything*

somewhere in here is a way to access and store data, or at least i'm hoping so, then i can experiment with changing data, its proving to be a little elusive right now.
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 11th Jan 2016 15:40
I use this program to edit Lua files. LuaEdit 2010
http://luaedit.sourceforge.net/
or
http://sourceforge.net/projects/luaeditor/
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2024-12-22 12:02:33
Your offset time is: 2024-12-22 12:02:33