blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 04:19 AM |
Action Framework v1.0 =====================
For too long, our scripts have been out of sync. Our LocalScripts and Scripts haven't been able to communicate. But now those days are over! I've developed the [**Action Framework**][1], an API dedicated to sending messages between scripts.
Setting It Up ------------- 1. Put `ActionFramework` in a place where it will be run. 2. Create *Script* or *LocalScript* as the source. 3. Put *StringValue* named `Action` in the source. 4. Put *StringValue* named `Arguments` in `Action`. 5. Put *ObjectValue* named `Source` in `Action`. 6. Put the following code at the top of your source:
local Action do repeat wait() until _G.Action; Action = _G.Action(script); end This will allow you to use the framework in your code.
The framework should now be set up in your code. Repeat steps 2-6 for each script that will use the framework.
Using the API ------------- ActionFramework Action { void Send( string action, Instance receivingScript, ... ), table SendAndReceive( string action, Instance receivingScript, ... ), RBXScriptSignal Received{ RBXScriptConnection connect( void onReceiveCallback( string action, Instance sourceScript, table arguments ) ) } }
The API is simple to use, and an example is provided in the [model][1] for you to look at. But just in case that example wasn't satisfying enough:
In a *LocalScript*:
script.Parent.MouseButton1Click:connect(function() Action:Send("shutdown", workspace.OperatorScript, game.Players.LocalPlayer.userId) end)
In a *Script*:
function onActionReceived(action, source, arguments) if isOperator(arguments[1]) then if action == "shutdown" then … end end end Action.Received:connect(onActionReceived);
Possible Uses ------------- * My upcoming Audit Log project * Admin scripts with a LocalScript for GUI stuff * Client-server GUI interface * Anything that has to do with interscript communication
~ blocco
[1]: http://www.roblox.com/item.aspx?id=122115745 |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 04:32 AM |
Revision -> v1.1 ---------------- * *BindableEvent* `ActionReceived` now put into scripts themselves * * fixed bug where you could get ANY script's actions |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 05:21 AM |
| Link for those who didn't see it: http://www.roblox.com/item.aspx?id=122115745 |
|
|
| Report Abuse |
|
|
bohdan77
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 7944 |
|
|
| 10 Jul 2013 07:17 AM |
| I've been doing things similar to this for a long time. Just never made it so huge. Nice job though. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 10 Jul 2013 07:23 AM |
>Action:Send("shutdown", workspace.OperatorScript,game.Players.LocalPlayer.userId)
>if isOperator(arguments[1]) then
Either I read it wrong, or that wouldn't work? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 07:25 AM |
| It's a snippet to see what you can do. I wasn't going to write everything. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 10 Jul 2013 07:26 AM |
| Okay then. Disregard that :D |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 10 Jul 2013 07:27 AM |
cool, i might use this....though usually i just put children into an object and use childadded, since none of my stuff relys heaevily on communication, instead it only needs it for a couple of things
AW MAN THIS ISN'T WHERE I PARKED MY CAR |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2013 08:17 AM |
| Can it even serialize tables? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 08:18 AM |
| That will be a future feature. Which I will probably implement today. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 10 Jul 2013 09:06 AM |
| Does anyone know how to bypass null-terminated strings in StringValues? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2013 10:56 AM |
| oooh, nice. I might use this. For my current project i've been syncing Guis with StringValues and stuff, but this could be a little neater. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 12 Jul 2013 12:16 PM |
I updated the Action Framework to Version 1.2!
Now you the code sets everything up for you and all you have to do is put the initialization code at the top of your script. :D |
|
|
| Report Abuse |
|
|
bohdan77
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 7944 |
|
| |
|
Maradar
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 4478 |
|
|
| 12 Jul 2013 04:51 PM |
blocco, thank you, thank you one million times. this will help many games, i know it.
~Tanner L. Ghosen~ |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2013 07:59 PM |
| It's funny you released this just as Anaminus created roblox-cure, which includes a pretty interesting network library that allows servers and clients to communicate with packets and stuff. It's documented too. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 13 Jul 2013 01:43 AM |
duh wat
and i have to work on formatting my arguments, i just hate the fact that stringvalues are null-terminated |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 13 Jul 2013 03:47 AM |
| @Oysi: Did you advertise it by thread? |
|
|
| Report Abuse |
|
|
bohdan77
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 7944 |
|
|
| 13 Jul 2013 10:06 AM |
@colorfulbody
Where can I find that? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 13 Jul 2013 10:11 AM |
| I would like to know where that is too |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2013 11:22 AM |
| It is here: github dot com slash Anaminus slash roblox-cure slash blob slash master slash source slash info slash network.md |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 14 Jul 2013 08:03 AM |
Updated ActionFramework to v1.3.4;
* Auto-Updates * Auto-Distributes |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2013 08:15 AM |
| Why use things like StringValues and ObjectValues when you can use shared or _G? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 14 Jul 2013 08:39 AM |
| shared or _G doesn't replicate from server to client |
|
|
| Report Abuse |
|
|