Scripts / Add Script ?

Author
Message
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 16th Dec 2015 19:37
Hi,
How to add script for my game easily?
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 17th Dec 2015 08:28
Just put the script file you want in the gameguru > files > scriptbank folder, then in the editor place the object you want to run the script, click it, select properties and then change the script in the drop down near the top of the list. That's all.

If you mean how do you write scripts then that's a little more complicated, there's a fairly good guide here in this forum forum section that teaches the basics.

https://forum.game-guru.com/thread/208970
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 17th Dec 2015 09:13
Thank you for help.
PM
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 22nd Dec 2015 12:01 Edited at: 22nd Dec 2015 12:07
Please more information
For example how to add this script in my game ? Easy please

function ui_init(e)
HideHuds()
end
function ui_main(e)
end
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd Dec 2015 13:06 Edited at: 22nd Dec 2015 13:07
1. Open notepad
2. Paste your code in
3. Go to File -> Save As
4. In the "Filename" field type ui.lua
5. In the "Save as type" drop down select "All Files"
6. Click Save
7. Move the file you just made to your scriptbank folder (it should be somewhere like program files/steam/common/steamapps/files/scriptbank)
8. In GameGuru place the item you want to use it on
9. Click on the item you placed and select properties
10. Find the AI field and click the little box at the end
11. Highlight ui.lua and click ok
12. There should be a field in properties to define if it is always active, make it always active.
13. Apply the changes in the property window.

You may have to make the item dynamic in the properties, I can't remember if you need to or not.
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 22nd Dec 2015 13:31
Thank you for reply and detailed help .
Code runiing now Bbut sometimes code does not work and ı close software and open again gameguru runing code.
Gameguru necesarry update for script partial, I will report it.
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd Dec 2015 13:39 Edited at: 22nd Dec 2015 13:42
Try putting the command under main instead of init, that might make it work a little better, might not but you never know.




Just a word of warning: When you have HideHuds running, in test mode you won't be able to press TAB to change settings.

Have you looked at the example script thread? There's lots of very useful scripts in there.
https://forum.game-guru.com/thread/207801?page=1
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 22nd Dec 2015 13:43 Edited at: 22nd Dec 2015 13:50
I can not run this code

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd Dec 2015 13:52 Edited at: 22nd Dec 2015 13:58
Try this (make sure you save it as carry_object.lua in the way I described before):

Make that the entity has 'static mode on' = "No"'



I'm not sure if it will work (i'm still learning myself) so make sure you keep a back up of the original.
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 22nd Dec 2015 14:14 Edited at: 22nd Dec 2015 14:15
Script nruning now. Thank you for interested.
Script file name already carry_object_init.lua
You told change name carry_object.lua and now script is runing.

Filename effect script ? and why type filename carry_object.lua is script start correct runing ?
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 22nd Dec 2015 14:44 Edited at: 22nd Dec 2015 14:46
the file name needs to match the functions in the script

so if your script has the following lines:


then your file should be named carry_object.lua

and likewise if your script has the following lines:


then the script needs to be called random_words.lua

and so on.

this basically calls the script into memory and tells the engine which script it's running from so they need to be named correctly otherwise they get mixed up with other scripts running.

I know it's a little confusing to start with, but once you get to learn the basics you'll realise how simple it is really.
kcan
9
Years of Service
User Offline
Joined: 13th Dec 2015
Location:
Posted: 22nd Dec 2015 14:58 Edited at: 22nd Dec 2015 15:00
Thank you for help.
PM

Login to post a reply

Server time is: 2024-12-22 10:20:56
Your offset time is: 2024-12-22 10:20:56