Scripts / Scripting change in 1.7 Heads up!

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th May 2014 22:01
Hello. Just to save you the bother of working out why old scripts are not working with 1.7. The system has changed, or it sure seems to have. You can now no longer use require. Instead just put your globals at the start of your actual script Actually easier to work with so far! Plus the fact you can edit scripts on the fly without having to reload FPSCR each time, bliss!



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th May 2014 22:16 Edited at: 29th May 2014 22:17
wow yh it really does treat them as globals now... well guess i better remember to add "local" onto my timer varibles in future XD



ah well i do like the 'on the fly' scripting though! it's so much nicer

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th May 2014 00:55
I haven't thoroughly tested they work as globals as yet, but in my first tests it has worked fine. Glad it works okay for you smallg, does it work ok for multiple scripts? The only script I have started really doesn't need globals, just locals, but I'll be sure to test out multiple scripts at some point. Just wondering if you have already tested

And yes, the scripting while reloaded is running has sped up my work flow enormously. It was quite a nasty process before, especially if it crashed, which was often



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
Avram
GameGuru TGC Backer
18
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 30th May 2014 01:04
Pity... there are situations when you really need to use "require".

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th May 2014 01:11
Well, for now it seems we cannot I think TGC are rewriting their Lua stuff all over, and that may mean loss of some commands for awhile. I know the original used a third party system that was causing issues, for one resulting in globals never being reset properly. For example my farming scripts once used, each test run resulted in the variables continuing from their last state, rather than afresh. The globals seemed to be ignored after first use. That certainly seems to have been fixed!



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th May 2014 01:33
Quote: "resulting in globals never being reset properly. For example my farming scripts once used, each test run resulted in the variables continuing from their last state, rather than afresh. The globals seemed to be ignored after first use. That certainly seems to have been fixed!"




yh this is great also and yh varibles are now global, need to remember to use
when defining varibles now but it's ok, i'd rather spend an extra 2 seconds typing that than restart reloaded everytime i want to edit something

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 30th May 2014 03:22
@Smallg, when defining a local variable where do you type it is it like such:





PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb D
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th May 2014 11:50
i have been typing


but if there is a way to define a group as local that would be cool too

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 30th May 2014 22:22
The solution is as follows:







I took the time to figure it out this morning. Now it works the way standard LUA is supposed to work.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.006
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 31st May 2014 02:49
If we can define globals in the start of our own scripts then we shouldn't need this except for if we wanted to use other or custom Lua librarys

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
tomjscott
User Banned
Posted: 31st May 2014 06:26
Quote: "If we can define globals in the start of our own scripts then we shouldn't need this except for if we wanted to use other or custom Lua librarys"




The purpose of global functions and global variables is for them to be accessible from all your scripts. If you define functions and variables in each script then those are local to that script and no longer global. What you are suggesting is akin to taking the global.lua file provided by TGC and putting that at the beginning of every one of your scripts so you can access those functions.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.006
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 31st May 2014 09:36
no what i was saying was you only have to define the global at the start of ONE of your scripts and your other scripts can access that global i have tried and tested this and found it to work, if you want a variable local to that script you define it by typing local first it's as simple as that

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
tomjscott
User Banned
Posted: 31st May 2014 16:26
Quote: "no what i was saying was you only have to define the global at the start of ONE of your scripts and your other scripts can access that global i have tried and tested this and found it to work, if you want a variable local to that script you define it by typing local first it's as simple as that"




OK, that's cool. I didn't realize that. But I prefer to put them in a single global script as is the usual method. And it works fine with the syntax I outlined. Thanks for the alternative solution though.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.006
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st May 2014 17:11
I did mention in the other post that although I hadn't tested it yet, the variables you set at the start should work throughout all your scripts. Still, nice to see the require option working again!



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
tomjscott
User Banned
Posted: 31st May 2014 17:12
Quote: "Still, nice to see the require option working again!"






System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.006
The Tall Man
10
Years of Service
User Offline
Joined: 24th May 2014
Location: Earth
Posted: 1st Jun 2014 00:50
I do hope the scripts are interpreted/compiled/tokenized during (or before) the building process, rather than during gameplay. Having a real-time interpreter would be a an unnecessary bottleneck (since Lee was saying in his blog that the AI had been so slow).
PM

Login to post a reply

Server time is: 2024-12-22 05:46:30
Your offset time is: 2024-12-22 05:46:30