Scripts / Can anyone help me with this please?

Author
Message
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 09:43
sorry to ask but I am struggling with this script, I am no scripter and yes I do need to learn

I am trying to hide an entity based on its name this is to swap out 2 entities to give the effect of 'on' and 'off' I want to reference the object by name not ID so that it can be used with specific entities i.e emissive.

this is what I have so far but it errors on line 7 I think I have missed a declaration somewhere but not sure what

thank you for any help you can give


Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Bored of the Rings
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: UK
Posted: 12th Apr 2018 11:42 Edited at: 12th Apr 2018 11:43
to access the object name , you need to add ',name' to the _init section. read your post quickly am at work. will try and give more help later if I get a moment. although others will most likely help before I return here.
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: SegAutoWelder, Entity+Weapon Welder, FPEtoBAT, DBO2X
PM
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 12:20
ok thank you BOTR
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Bored of the Rings
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: UK
Posted: 12th Apr 2018 12:27
sorry I meant to add i.e. function on_off_init(e , name)
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: SegAutoWelder, Entity+Weapon Welder, FPEtoBAT, DBO2X
PM
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 13:20 Edited at: 12th Apr 2018 13:23
Hi BOTR I have tried that and still get an error

do I have to put name after all the [e] so should it be [e,name] on all of them?

I'm a real script virgin lol

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments
Belidos
3D Media Maker
2
Years of Service
User Offline
Joined: 23rd Nov 2015
Location: Hertfordshire
Posted: 12th Apr 2018 13:34
If you look at the door.lua script at the key part of it, that should give you an idea of how to set the script up to use the ifused field and name field so you don't have to hard code the name in the script and can reuse it on multiple objects.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
J_C
10
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 12th Apr 2018 17:28
Hi GraPhix .. I am not sure you can do it the wauy you started..
but here is one way .. there are probably 1000 ways...

I have done 2 scripts... one for the light models and one for the timer switch...

Light model script... light_on_off.lua


timer switch script... light_timer_switch.lua

PM
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 17:45
J_C thanks for this giving it a whirl now
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 17:59
thank you so much it works perfectly

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
2
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th Apr 2018 21:27
So my take on this:



All controlled by the names of the entities.

The box is called "barrel_trigger" and the barrels are called ... wait for it ... "barrel_main" and "barrel_alt".

I'll let you figure out how the script works but I've left a Prompt in there to give some hints.


Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 12th Apr 2018 22:17
Hi Amenmoses thank you I will have a play with this
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
2
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 13th Apr 2018 10:39
Btw, the 'names' can be anything you like, the underscore character separates the 'name' part from the 'identifier' part so for example: "light001_main", "light001_alt", "light001_trigger" would also work.

I haven't tested it with multiple triggers for the same 'name' but in theory it should work. Also the trigger should act upon all the entities with the same 'name', again I didn't test it with multiples so let mne know if it doesn't.


Been there, done that, got all the T-Shirts!
PM
GraPhiX
3D Media Maker
13
Years of Service
User Offline
Joined: 15th Feb 2005
Location: Old Trafford - Lancashire
Posted: 13th Apr 2018 10:56
I'm having a play now thank you very much
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Login to post a reply

Server time is: 2018-04-25 18:48:57
Your offset time is: 2018-04-25 18:48:57