|
| 20 Aug 2015 09:25 PM |
You don't have to give me all of them--but please explain at least some of these concepts to me.
1) RunService(specifically RenderStepped) 2) Raycasting 3) String manipulation(like chat arguments)
Thank you!
Green tea is green tea if its just green tea |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Aug 2015 09:27 PM |
#1, RenderStepped is a Signal that is invoked every time your client renders a frame which is usually about 60 times a second
#2, RayCasting just shoots a 'ray' from some origin, towards some direction and magnitude (meaning if you did Vector3.new(100, 0, 0) it would shoot it right 100 studs) and it finds the object it hit and what position the ray hit the object at
#3, Manipulating strings to usually make it easier to work with |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
| |
|
|
| 20 Aug 2015 10:24 PM |
What about _G.*
Are those global functions?
Green tea is green tea if its just green tea |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Aug 2015 10:24 PM |
| no, it's just a table shared across all scripts on that machine |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 11:28 PM |
so i can access another function from another script?
can i get an example? is it like _G.hi = "Hello"
Green tea is green tea if its just green tea |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 21 Aug 2015 12:38 AM |
1) RunService(specifically RenderStepped)
RenderStepped is an event of RunService, which basically fires every new frame for the client. It's like the FPS for the game.. aproximately runs every 1/60th of a second so it's faster than using the 'wait' function. But it can only be used on the client - e.g. localscript.
ex;
game:GetService('RunService').RenderStepped:connect(function() print'1/60th of a second'; end)
---------------------------------------------------------- 2) Raycasting
Raycasting is like you make a ray from point 'A' to point 'B' in the world space. The objective is to get anything intersecting between them.. a little visual;
A ----------|--B ^ This would be detected.
You can create a new ray with the Ray.new function.. which takes arguments of the start and end of the ray, so a ray will be casted from the start in the direction of the end to pick up anything in between with the FindPartOnRay or FindPartOnRayWithIgnoreList function of workspace.
ex;
local a = Vector3.new(0,0,0); local b = Vector3.new(0,10,0);
local hit,pos = workspace:FindPartOnRay(Ray.new(a,b));
print(hit.Name.." was found at "..pos);
---------------------------------------------------------- 3) String manipulation(like chat arguments)
String manipulation is the mechanics of configuring text. Chat arguments normally include using 3 functions.
string.len - Returns the length of the given string. string.sub - Returns a substring in a given string with the given dimensions; inclusive. string.lower - Returns all lowercase version of the given string
ex;
game.Players.PlayerAdded:connecy(function(plr) plr.Chatted:connect(function(msg) if msg:sub(1,2):lower() == 'hi' then print(plr.Name.." is greeting someone"); end end) end) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Aug 2015 01:18 AM |
'which takes arguments of the start and end of the ray' Uh no, that is not how raycasting works. |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 01:19 AM |
| I think people use module scripts now instead of _G |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 21 Aug 2015 01:45 AM |
| @cnt, uh yeah pretty much is. Technically, it takes arguments of start and DIRECTION but that could just as well be represented as the supposed end of the ray if there are no intersections between point A and B. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Aug 2015 01:51 AM |
| No, it can only be the 'end of the ray' if the origin is at (0, 0, 0) |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2015 09:25 AM |
thanks guys you guys really helped explain a lot--one more thing
what do modulescripts do?
Green tea is green tea if its just green tea |
|
|
| Report Abuse |
|
|
Famion
|
  |
| Joined: 29 Nov 2008 |
| Total Posts: 1043 |
|
|
| 21 Aug 2015 09:28 AM |
ModulesScripts can hold resources for the scripts in your game. Many use them to hold gamemodes for their games. They can be renamed to 'MainModule' and be required(), acting as a hidden script that people can't use (it doesn't have to be free).
|
|
|
| Report Abuse |
|
|
Famion
|
  |
| Joined: 29 Nov 2008 |
| Total Posts: 1043 |
|
| |
|