Page 1 of 1

Coding For newbies.

Posted: Sat Jul 11, 2015 12:16 pm
by Eleven Warrior
Ok this is going to be a site for simple coding for new comers and intermediates to LOG 2. To make things easy all seaches will need this EL_...

1- How Print gui text to the screen:

1 x Script Entity with the below code added into it>

1 x floor_trigger_1 connects to the Script Function: helloworld() Or what ever you name the floor_trigger eg: my_floor_trigger_1
** Remember the floor_trigger can be disabled in the tick box and activated, deactivated by the various methods:
Party
Monster
Item
digging
**
The floor_trigger can also be toggled, be warned of this because you may only want the trigger to activate once for (hudPrints) atm..

If you need a hudPrint once then set the floor_trigger to (disableself)

Code: Select all

function helloworld()
   hudPrint("Eleven: Hello guys how are you?")
end
easy as yeah:)

EDIT: I will constantly update this post as much as possible is needed if not then ill delete it. At the end of the day its' for
all ok :)


Ok Great people of this mystic forum anwha thesja ejia shhhhhhhhhhhhaaaa help these begginers and all that stumble on this site,..... Don't forget to ad El at the begging or end of you post so the search is easier for the modder please

Re: Coding For newbies.

Posted: Sat Jul 11, 2015 5:21 pm
by billb52
Hi there Eleven Warrior I think it is a good move to enlighten newbies & intermediates to coding, I have followed many of your examples and mods in the past
Keep up the good work! as we will all benefit from it...

Re: Coding For newbies.

Posted: Sun Jul 12, 2015 5:35 am
by Eleven Warrior
Hello out there guys :)

Ok I showed you how to connect a floor_trigger to (function) that allows you to (hudPrint) text to the screen below example.

Code: Select all

function helloworld()
   hudPrint("Eleven: Hello guys how are you?")
end
Now we can do many cool things with this basic function.

1 - We can get a (timer) to activate, a (counter) to increment or decrement, open or close a door. The possibilities are endless.
1a - You should have a floor_trigger connected to the last lot of code function in your Dungeon Editor already.

2 - Ok in (Dungeon Editor Map: Level 1. I have this (Code Below) activate a timer. after a certain amount of time let's say (1.1 seconds) The timer will toggle the door up and down every 1.1 seconds. I used this as a very simple puzzle. Behind the door is a pressure_plate that is activated by an item. Basically the player had to throw a item under the door to stop the timer and open another door. You had to throw the item at the right moment lol.

3 - Add a door to the Map called: my_door_1 (The door has to be set to either open or close) In this case it's close.

4 - Add a timer to the Map called: (my_door_timer_1.)
- Under Components: Untick timer: Untick disableSelf: Set timerInterval to 2.5:
- Connect the Timer to the Door.
- Under Connectors: onActivate: my_door_timer to my_door_1: toggle

Code: Select all

function helloworld()
   hudPrint("Eleven: Hello guys how are you?")
     my_door_timer_1.timer:start()
end
-5-
This is the Dungeon Editor File: Newbies_Dungeon.zip
My Drop Box Link: https://www.dropbox.com/sh/tx8r8dwlz9ibfj8/ppISEmYxel

You will also see some extra things I have doen in this file as well :) Next step I has to code what is happening in the file atm.

-5a-
This is the latest learning Dungeon:
This is the Dungeon Editor File: Newbies_Dungeon_v2.zip
My Drop Box Link: https://www.dropbox.com/sh/tx8r8dwlz9ibfj8/ppISEmYxel

I have added quite a lot to this one so enjoy and have fun :)

-6-
Hello again guys :) Well we most certainly have a ripper here from Azel. This Scripting will show you what you can do with Mimics and how to use them in your Mod. It also shows you how to turn a Chest into a mimic eg chest_1 and using additional Script for chest_2
Thank you Azel for this one :)

This is the Dungeon Editor File: MimicFun.zip
My Drop Box Link: https://www.dropbox.com/sh/tx8r8dwlz9ibfj8/ppISEmYxel

Ok so enjoy this one i'ts cool :) Ohh and soon i'll have the second part of (Newbies_Dungeon.zip) completed for you to enjoy. In the newest version i'll show you how to use (levers, wall buttons, torch holders and much more).

Re: Coding For newbies.

Posted: Wed Jul 15, 2015 12:58 pm
by akroma222
Great idea pinning these beginner coding threads,
Many people, me included, have difficulty with the basics sometimes
It's easy to take for granted... but modding does require some initiative and willingness to learn the fundamentals
Hehehe for some us the fundamentals mean different things

I will try and help out where I can...

Also, paste this to the original post

Lua 5.1 Reference Manual
http://www.lua.org/manual/5.1/

Lua-users wiki
http://lua-users.org/wiki/

And from above, wiki on Lua Tables I have found useful (tables are great but sometimes tricky to handle)
http://lua-users.org/wiki/TablesTutorial

All the best,
Akroma

Re: Coding For newbies.

Posted: Thu Jul 16, 2015 10:48 am
by Eleven Warrior
Thank you Akroama. It would be a pleasure to have anything you post here for sure mate :) Your work is excellent from what you have helped me with and you contributions here are most welcome :)

Re: Coding For newbies.

Posted: Mon Jul 20, 2015 7:16 pm
by trancelistic
I think this is very nice. Perhaps I got something later if it doesn't exist already haha:)

Re: Coding For newbies.

Posted: Wed Jul 29, 2015 10:36 am
by JohnWordsworth
Great idea for a thread (along with the other one). Could I just advise that Eleven Warrior (or a mod) sets them to "Sticky" and not "Global" as they appear everywhere in all forums, which seems inappropriate.

I noticed a while ago that anyone is able to post a global announcement here on the forum, but figured it was just a mis-aligned forum permission, as those rights are usually reserved for mods/admins!

Re: Coding For newbies.

Posted: Fri Jul 31, 2015 7:43 am
by Eleven Warrior
Hi. Yeah I agree with you Jon mate but it wont allow me to Unlock and use as a sticky.