SRL Archive - RS Scripts

Scar Server Tool


caused

2009-07-21 03:33:44

I Currently Need beta Testers!
and someone to optimize the sst.scar. ;)

Please Reply in this Thread if you can help me out, i would be glad :).

Introduction:
I'm introducing my latest addition to scar : D…
With this Server tool the following things will be possible with scar.

  • Bots that Communicate with each other
  • Scripts that Help Each other. Ie. One Player Mines, the other one only banks.
  • A Chat Client With Scar
  • Scar Games With Multiplayer(network) Feature
  • Basicly anything that requires 2 (or more) scar clients to connect with each other via ip.

Setup:
Super Easy!.
- Copy the sst.scar to your scar/includes Folder
- thats it.

Usage:
1. Run SST.exe, Click on Start Server

2. Include the sst.scar in your Script.

You can currently use the following functions with sst.scar.
SstSend(string):
Sends a Variable to the Server.

SstGet(string):
Receives a Variable From the Server.

More… See Example..

Example Code:

program ScarServerExample;
{.include sst.scar}
var
status : string;
begin
SstIp := '127.0.0.5'; // If this is not set, it will connect to 127.0.0.1
SstDebug := TRUE; // Use Server Debug

SstSend('d=9'); // This sends data(var d=9) to the server.

If SstExists('d') then //SstExists checks if the variable is known. Results True If available.
status := SstGet('d'); // This Gets Data(var d) From the Server and saves it to status.

WriteLn(status); // Output var d

SstDelete('d'); // Deletes var d from the server. Returns TRUE if successful, False if not.

end.

Info:
So, what this server technically does is managing the variables it receives through SstSend(x=y :string);, and Sending the Requested Vars back.
On the programme interface the "Connect to Server" Feature, can be used to directly change Vars the script is using. For example, if you want to tell the script to go Banking, you can do it directly that way.

Conclusion:
I hope you appreciate my effort, and would be grateful if anyone supports me with this project( Debugging, testing, improving the .scar include)

This is in Alphastate, so dont yell at me if something doesnt work as smoothly as it could : D…
Though i did some testing, and didnt spot many problems yet.

Feel Free to offer Suggestions for the next version :).


//UPDATES
V0.2
- Quickfix for the Send Data Button o_o;;.

V0.3
- Functionality to the "Check for updates" button added.
- Updated sst.scar (Thanks ShuttleU)
- Minor Bugfixes.

V0.4
- Added SstExists Function to Server and .scar file
This will check if the server knows a var and results TRUE if its known.
- Improved sst.scar
- More Debug Functions
- Bugfixes…
- New Example Code
- Examples Folder Added

V0.5
- Bug that caused an exception when accesing server for the first time fixed
- Hopefully all other major bugs fixed ;)
- Added SstDelete(string)., Deletes a given Var. Returns TRUE if succesfully, FALSE if not.
- Added a chat.script as example :)

V0.6
- Minor Bugs fixed
- Port Selection
- sst.scar improved(No more access violation when the server is not running)
- Example scripts updated

~caused

TRiLeZ

2009-07-21 03:39:05

This sound sweet!
Im gonna beta test this.

Shuttleu

2009-07-21 03:41:18

sounds interesting
well done

but why not use scarintermessaging?

~shut

caused

2009-07-21 03:47:31

Trilez: Thanks ALOT! :). I'm eager to see what you will create :).
Get the newer Version i just uploaded though ;).

ShuttleU: Thanks, feel free to betatest it ;) (Newer Version (0.2)) available!.
Scarintermessaging is bound to one pc.

TRiLeZ

2009-07-21 04:00:15

What port does it use?
I need to port forward and most other people will need too.

caused

2009-07-21 04:04:24

From: TRiLeZ
What port does it use?
I need to port forward and most other people will need too.


Port 123 ;).

Good Point Though. I'll add an feature for selecting the Port.

Shuttleu

2009-07-21 04:11:11

change it to 80

~shut

EDIT: replce sst.scar with this
function Connect(mycon : Integer):Integer;
begin
mycon := OpenConnection('127.0.0.1',123,1500);
WriteLn(mycon);
if mycon = -1 then
WriteLn('Server not Started!');
result := mycon;
end;

function sstsend(scardata : string):boolean;
var
mycon : integer;
begin
mycon := Connect(mycon);
if IsConnectionOpen(mycon) then
begin
SendConnectionData(mycon,scardata+#10);
WriteLn('data sent');
Result:= True;
end;
end;

function sstget(scardata : string):String;
var
mycon : integer;
databuff : string;
begin
mycon := Connect(mycon);
if IsConnectionOpen(mycon) then
begin
Insert('get=',scardata,0); //serversyntax
SendConnectionData(mycon,scardata+#10);
ReadConnectionData(mycon,databuff);
databuff := copy(databuff,0,Pos(#13,databuff)-1);
WriteLn('Received vardata: '+databuff);
result:=databuff;
end;
end;

caused

2009-07-21 04:46:02

Nah, Port 80 is my Webserver : D…

Thanks for the Standards =).. I will need to improve the Performance though… and adding exceptions for everything …

If anyone wants to do that :D?

senrath

2009-07-21 04:49:06

From: caused
Nah, Port 80 is my Webserver : D…

Thanks for the Standards =).. I will need to improve the Performance though… and adding exceptions for everything …

If anyone wants to do that :D?


Port 80 is also what you're using right now to browse the internet. It can be used for more than one thing.

TRiLeZ

2009-07-21 04:55:47

I may not be able to test that much because my router is messed up and port forwarding dosnt really work. =/

caused

2009-07-21 04:56:42

From: TRiLeZ
I may not be able to test that much because my router is messed up and port forwarding dosnt really work. =/


You can test it local =).

Or send me your scripts ;)

senrath: I've had some bad experiences with Port 80. I'll stick to 123 for now and add a Feature to select your favourite Port in later versions :)

mixster

2009-07-21 11:08:52

Assuming that, at heart, the exe is just a listening/server socket? If so, sharing sauce shouldn't be a problem. SRL loves open sauce :)

Using an exe to bypass Scar's lack of listening sockets is a bit overkill though and I have used it before for testing purposes (I don't use it for anything since I don't expect people to want to run an exe for a bit of functionality, so usually use a php server as a medium if need be), but adding a native one makes a lot more sense, though I have tried and failed introducing one through a plugin a couple of times.

Shuttleu

2009-07-21 11:59:19

the only reason i said 80 is because i have 80 already forwarded to my laptop so i can use it as a server

~shut

caused

2009-07-21 16:44:05

New Version!.

V0.4
- Added SstExists Function to Server and .scar file
This will check if the server knows a var and results TRUE if its known.
- Improved sst.scar
- More Debug Functions
- Bugfixes…
- New Example Code
- Examples Folder Added


I also added an example code, that shows you how to move the Mouse on another PC.
Basicly this is the first step to a programme that allows remote maintenance ;).

mixster: I'll add the sauce once its tasty : D.

ShuttleU: Yeah, Port 80 is coming soon =)…

~caused

MylesMadness

2009-07-21 18:54:26

I did this a long time ago, just with php.
http://www.villavu.com/forum/showthread.php?t=36546

edit: After reading all that code, I would have done it a WAY different way. Maybe I will rewrite it…

Janilabo

2009-07-21 22:05:37

Wow, good work, caused! :)

This looks very promising project so far.

caused

2009-07-22 02:33:42

Update! I call this the first "stable" version. Since i didnt find any bugs yet. So it's ready for use with any script :).

Updates in 0.5
V0.5
- Bug that caused an exception when accesing server for the first time fixed
- Hopefully all other major bugs fixed
- Added SstDelete(string)., Deletes a given Var. Returns TRUE if succesfully, FALSE if not.
- Added an Chat.script as example.



MylesMadness: Cool. A php server is another great idea =). Though not everyone has one. But a php server is optimal for stats and stuff i guess =).

Janilabo: Thanks ALOT. Feel free to test it out, it seems to be stable now :).

n3ss3s

2009-07-22 19:27:50

EDIT: Misunderstood shit

MylesMadness

2009-07-22 19:30:01

From: n3ss3s
This isn't anything new guys… Only way I see this differs from just using OpenConnection and Send/ReadConnectionData is that it has cool writelns?

Sorry m8… Btw what's the EXE for?
I think scar talks to that and that goes to the Internet.

caused

2009-07-23 03:26:17

Nah, it stores the data it receives and handles requests =)..

Didnt have the time to finish the update i planned for today .. Too much work T_T…

Anyways…., huge.. and probably last update soon ! =)

Home

2009-07-23 04:30:36

This looks cool :) I hope that someone will find this usefull ( i think someone will ) ! :)
But anyways, good job matey.

~Home

caused

2009-08-16 18:26:11

Thanks Home :'D.. I Hope so too.. anyways.. I gotta start using it when my army is done =).

Update. Probably the last one. If you find bugs i'll fix em though.
Port 80 for those who requested it added ;).

V0.6
- Minor Bugs fixed
- Port Selection
- sst.scar improved(No more access violation when the server is not running)
- Example scripts updated

cycrosism

2009-08-18 15:00:38

Make one work on Ubuntu?

caused

2009-08-18 18:05:37

From: cycrosism
Make one work on Ubuntu?


hmn.. i may recompile it for Linux.

Did you try Wine ?.

~caused

mixster

2009-08-18 20:23:35

I would assume it would work with Wine and unless it didn't, I wouldn't see a need to recompile for Linux.
Oh and you should write down about the protocol you use for it or release the sauce already :)

cycrosism

2009-08-19 09:56:25

Yes I tried wine I got a socket error while clicking start server

Neehosoft

2009-08-19 09:59:50

great idea, i was working on something like this for NS, think i could just incorporate yours into NeehoSwitch? Im asking for permission. And ill test

cycrosism

2009-08-19 10:03:49

The exact error was

"Socket Error # 10013
Access denied."

That only comes up after I click start server

caused

2009-08-20 05:05:20

From: cycrosism
The exact error was

"Socket Error # 10013
Access denied."

That only comes up after I click start server


Sounds like a firewall or something is blocking the sockets.
Did you try the port 80 option ?. Dunno. But it sounds like a solveable problem.

Neehosoft: What is NeehoSwitch :'D?.. Sure implement it any way you want :).

~caused