SRL Archive - SRL Archives

SRL Player Remote


Shuttleu

2011-08-13 17:31:20

Hello SRL

i have come to announce my SRL Player Remote which is based off of this

This will allow you to add, remove or edit players during runtime

The remote is in two separate parts

First there is the Form, for this you will need to move the sex file into your extensions folder, from here there will be a menu called "SRL Remote"

This will allow you to edit the scripts player properties

If you are running more than one script then a form will popup first asking you which script instance you would like to edit

for developers there are three things they need to know about
SetupSRLRemote
SRLRemote
RemoteInstance

in order to use the remote you must call SetupSRLRemote
you can do so by using
procedure SetupSRLRemote(ScriptName: string; Integers, Booleans, Strings: TVariantArray; StringValues: array of array of string); 
now dont worry if you dont understand these, i will explain
ScriptName is simply the name of the script so "Vine Vanquisher"
Integers, Booleans and Strings are each arrays from the player array (Players[0].Integers[0], Players[0].Strings[0] etc.) and must be fileld in a particular way (string, int, string, int)
first you put a one or two word description of what the variable is for, then you put the variable index

so for example, lets say i have this in my setup

Players[0].Integers[0]:= 5; //Loads
Players[0].Integers[2]:= 45; //Time till break
you would put this as
['loads', 0, 'time till break', 2]
as you can see the name matches up with the index

this is the same for the strings and booleans

and lastly we have StringValues
now this is because strings are different in scripts because you want the user to choose certain ones, otherwise the script might not work, so that is what this is for
so lets say for Strings i put
['Location', 0, 'Tan Type', 1]
using StringValues you define what options the user can choose for the strings
so you can put
[['Al Kharid', 'Lumby', 'Draynor'], ['Soft', 'Hard', 'Snake', 'Dragon']]

So in total the setup could look like
SetupSRLRemote('Ultimate Tanner', ['Loads', 2], [], ['Location', 1, 'Hide Type', 0], [['Al Kharid', 'Lumby', 'Fally'], ['Soft', 'Hard', 'Dragon', 'Snake']]);

this is all you need to do to set up the SRL Player Remote

Now to make your script use the remote add this line somewhere it will get called frequently
SRLRemote;

and one last thing , there is a Integer which you can use to let the user know which instance the script is
RemoteInstance;
You can put this in your progress reports or put it somewhere so your user knows which instance it is

Well i think i have rambled on long enough so i shall give you the files (please not there may be bugs as i havent been able to fully test it but it should work)

Place remote.simba into Includes/SRL/SRL/Misc
and to use the remote in your script simply include the file

and SRLRemote.sex into your extensions folder

~shut

EDIT: Just remembered you probably want to see some images

Coh3n

2011-08-13 17:52:37

This looks awesome, Shut! :) Definitely has the potential to be added to SRL (after we know it's stable and all that good stuff). I'm wondering if it's possible to export some methods used in extensions to PS or vise versa. That would allow people to use your remote's code also as a player form. Kills two birds with one stone. ;)

E: Does this work? I didn't think you could declare string arrays line that.

SetupSRLRemote('Ultimate Tanner', ['Loads', 2], [], ['Location', 1, 'Hide Type', 0], [['Al Kharid', 'Lumby', 'Fally']['Soft', 'Hard', 'Dragon', 'Snake']]);
Guess you learn something new every day. :p When you say "StringValues" is that what's added to combo boxes for "Location" and "Hide Type"? How exactly does that work? Maybe including a picture of what the end result looks like with those settings will help with the understanding.

Shuttleu

2011-08-14 04:48:10

ah, just noticed something i didnt notice before
i cant use OpenFile in extensions

so im going to try another approach

i shall post here when im done

~shut

Shuttleu

2011-08-14 05:45:53

uploaded the new version

~shut

Shuttleu

2011-08-14 08:15:13

another update

also added a script you can use to test it out

~shut

Coh3n

2011-08-15 22:04:48

So Shut, was just thinking this can still easily be used for MSI to reset players. The user just wouldn't be able to reset specific player attributes because of the way MSI is written. It would actually work really well for script settings and player activity + breakLoads, breakTime, totalTime and totalLoads.

If you're interested in add this to MSI, fantastic, if not I'll add it to my to-do list as I can't see the new form being completely finished anytime soon.

Shuttleu

2011-08-16 03:42:20

From: Coh3n
So Shut, was just thinking this can still easily be used for MSI to reset players. The user just wouldn't be able to reset specific player attributes because of the way MSI is written. It would actually work really well for script settings and player activity + breakLoads, breakTime, totalTime and totalLoads.

If you're interested in add this to MSI, fantastic, if not I'll add it to my to-do list as I can't see the new form being completely finished anytime soon.

sure i would love to help add this

~shut

EDIT: however i do feel like the saving and loading of the vars functions will have to be changed for MSI as it doesnt use the Players array, it uses its own type (MSIPlayers?)

Coh3n

2011-08-24 18:40:38

This has now been added to MSI, and will be added to SRL as soon as I get my authentication back. I'll also send a pull request for SRLRemote.sex to be added to Simba.

E: https://github.com/MerlijnWajer/Simba/pull/38

Coh3n

2011-08-27 20:38:47

I'm using this with MSI right now and it asks me to choose an instance (with 3 options), yet I only have one running? Isn't it supposed to delete the remote file after the script is executed?

Shuttleu

2011-08-29 03:45:13

From: Coh3n
I'm using this with MSI right now and it asks me to choose an instance (with 3 options), yet I only have one running? Isn't it supposed to delete the remote file after the script is executed?


it cant delete the file because there is no DeleteFile in simba

so i have to set a bool in the ini to false when the script stops, it should work (at least it did when i done it)

the only reason i can think of is if you press the stop button two times which will terminate the script before it gets to set the var in the ini

~shut

Coh3n

2011-08-29 13:49:27

From: Shuttleu
it cant delete the file because there is no DeleteFile in simba

so i have to set a bool in the ini to false when the script stops, it should work (at least it did when i done it)

the only reason i can think of is if you press the stop button two times which will terminate the script before it gets to set the var in the ini

~shut
Oh okay. That's probably it. :)