SRL Archive - Research & Development Lounge

Script Crash Alert - Skype


Gunner

2014-06-05 23:23:57

I truly hope this is the right place for this, if it's not feel free to move it. Also, I couldn't find any threads on this through the search function, at least nothing obvious. However I can't believe it hasn't been suggested before.

Ok, I stopped short of creating a feature suggestion because, well, I'm not even sure this is plausible. I'm wondering if it would be possible for Simba to send you an alert via Skype (or any other means) when your script crashes. I think Skype would be the easiest, I may be wrong, but henceforth whatever system utilized will be referred to as Skype in this post to avoid confusion. Here are my prelimnary brainstorm ideas…

1. An official Simba-specific Skype account be created. There does not need to be multiple Skypes, as it would be sending the same message everytime. (Hello "yourname", your script has stopped.)
2. There would be a procedure you could add to your scripts such as skypeCrashAlert; that would be called at any point in the script that could crash. For example:


if not (whateverDidntHappen) then
skypeCrashAlert(user12345);
players[CurrentPlayer].Logout;
Terminatescript;

3. The script would then phone home to somewhere, (the villavu server? idk, you guys are the devs lol) which would have access to the Skype accout. That account would then send you a message via Skype that your script has crashed.
4. ???
5. Profit

Wait, what? No…

4. You would receive the alert on your phone, because if you don't have Skype on your phone, then L2technology bro.
5. You could then Teamviewer your computer from your phone, because if you don't have Teamviewer on your phone, then L2tech…ehh you get it.
6. You can either reset, or take whatever steps necessary to secure your botting account until you return to your PC.

This would be extremely useful for us suiciders/gold farmers for a couple reasons. We don't want to miss out on XP/GP, and we don't want to leave accounts logged out with resources because of the chance of a ban taking effect.

There would be one major issue beyond the logistics of making it work, and that would be maintaining the Skype account. New users to Villavu would need to be added to the Skype account and assigned a number or code that the server would translate for specific accounts. Or it could just use Skype names. Either:


skypeCrashAlert(user12345);
Or:

skypeCrashAlert(gunner.3788);

Users would post to a thread with their Skype name, and any person trusted with the capability would add them to the Skype contacts list and either create a Simba-friendly number/code for them, or just add their Skype name and it's done. Access to this Skype account would need to be VERY limited, perhaps only to devs and admins for obvious reasons.

My first plan was to use text messages to your phone, but realized there would need to be some kind of subscription service paid by Villavu for text message ability, so that's obviously out. The only other way to get a message to your phone would be through some kind of Instant Message service. Although Skype does have the ability to SMS, I believe it is a paid feature, so users would just simply need to have the Skype app on their phone.

I believe I have covered all of the basic logistics here, but I may be missing something. The specific application logistics would need to be worked out by people far smarter than I, so I'll just leave this here.

I do realize this may not even be possible. Scratch that, anything is POSSIBLE. I do realize this may not even be feasible, so if it's not, kindly let me know and I'll retreat to my think tank.

What do you guys think?

Sk1nyNerd

2014-06-05 23:57:49

i think @Robert was looking to do this but via text message or email a little bit ago? idk if he finished but im sure he has some pointers.

you just rambled on and on but if i get the jist of it you want some form of message telling you that your account has been logged out or that the script has been terminated?

Gunner

2014-06-06 00:29:23

From: Sk1nyNerd
you just rambled on and on but if i get the jist of it you want some form of message telling you that your account has been logged out or that the script has been terminated?


I wouldn't exactly call outlining an entire process rambling on and on. What exactly is with the internets not having an attention span longer than 2 paragraphs anyway?

On topic though, it's good to know that this isn't impossible to do.

Hazzah

2014-06-06 11:08:27

From: Gunner
I wouldn't exactly call outlining an entire process rambling on and on. What exactly is with the internets not having an attention span longer than 2 paragraphs anyway?

On topic though, it's good to know that this isn't impossible to do.


Yea I am fairly certain someone was doing this or has done this email already. I think the first time I saw something about it there were problems with sockets or something for simba but iirc that has been fixed since then.

I donno, Im not into this stuff but I do remember this being suggested at one point.

E: IS this like something you were looking for?
http://villavu.com/forum/showthread.php?t=108744

Gunner

2014-06-06 12:04:07

From: Hazzah
E: IS this like something you were looking for?
http://villavu.com/forum/showthread.php?t=108744


Well there shure iz a lotsa purty colors and symbles on dat dare page…problem is I don't have any idea what any of it says. As far as I'm concerned a socket is what I plug my computer into. As I said, this would have to be worked out by people far smarter than I. I just saw a problem and thought of a solution. As for the actual implementation, I is two stoopid.

Rich

2014-06-06 12:18:14

Brandon managed to get emails working properly. It was a couple of months ago but shouldn't be too hard to find

Ian

2014-06-06 13:03:27

If you can make simba use cmd (which is probably possible) then you could use this

As for having Simba use cmd, if you can't do it directly you could have Simba create a batch file containing cmd command that you want sent, in this case

Syntax: MsgToSkype –U “Recipient Skype ID” “My message”
You could then have Simba run the batch file, then delete the batch file to stop them cluttering things up. Or you could only have one batch file and just have Simba modify it each time.

There's probably a cleaner way to do it though.

Turpinator

2014-06-06 13:23:27

Meh. Skype is slow and not open source. To be in the include… i dont think any dev would let a non open source program in. Thats why simba was created in the first place.

Email or texts work just fine. i dont have skype on my phone. some people dont even use skype.

Hazzah

2014-06-06 19:33:40

From: Turpinator
Meh. Skype is slow and not open source. To be in the include… i dont think any dev would let a non open source program in. Thats why simba was created in the first place.

Email or texts work just fine. i dont have skype on my phone. some people dont even use skype.


I dont even have a phone smart enough to get skype on it :P

Foundry

2014-06-06 20:27:38

This can be easily accomplished using email as others have said. I actually set up a two way communication system for an include I wrote for a different game that constantly checked if anyone around me talked to me. If so it would send me the contents of the message and I could text back my response. I also had it send proggies every hour and send an error message when it broke.

Here is a link to the guide I followed to set up a php server that simba can communicate with to send and read emails. I know Brandon already made a mail function but this can read them too. Also, here is a thread where I asked some questions about it (may be helpful).

If you are only trying to get a text when it breaks then I would suggest using what Brandon made.

Lucidity

2014-07-02 15:12:48

Wouldn't it be easier to have your computer make a sound?

Brandon

2014-07-03 21:10:58

From: xevo1
Wouldn't it be easier to have your computer make a sound?


Somehow I never saw this thread.. :l

I wrote a little something out of curiosity again..
Can be further advanced to print messages and send messages as well as many other possibilities.. Turned into a plugin, it'd be a cool toy I guess..



/** © 2014, Brandon T. All Rights Reserved.
*
* This file is part of the SkypeHook API.
* SkypeHook is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SkypeHook is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SkypeHook. If not, see <http://www.gnu.org/licenses/>.
*/
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <iostream>
#include <memory>
#include <thread>

class SkypeAPI
{
private:
HWND WindowHandle = NULL;
HWND SkypeHandle = NULL;
std::uint32_t Attach_ID = 0;
std::uint32_t Discover_ID = 0;
const wchar_t* SkypeControlAPIAttach = L"SkypeControlAPIAttach";
const wchar_t* SkypeControlAPIDiscover = L"SkypeControlAPIDiscover";

public:
enum class ATTACH_STATUS : std::uint32_t
{
SUCCESS = 0, PENDING = 1, REFUSED = 2, UNAVAILABLE = 3, AVAILABLE = 0x8001
};


SkypeAPI(HWND WindowHandle);

const std::uint32_t GetAttachedID() const {return Attach_ID;}
const std::uint32_t GetDiscoverID() const {return Discover_ID;}

const HWND GetSkypeHandle() const {return this->SkypeHandle;}
void SetSkypeHandle(HWND SkypeHandle) {this->SkypeHandle = SkypeHandle;}

bool Connect()
{
DWORD_PTR Result = 0;
SendMessageTimeoutW(HWND_BROADCAST, this->Discover_ID, reinterpret_cast<WPARAM>(this->WindowHandle), 0, 0x0000, 100, &Result);
return Result != 0;
}
};

SkypeAPI::SkypeAPI(HWND WindowHandle)
{
this->WindowHandle = WindowHandle;
this->Attach_ID = RegisterWindowMessageW(this->SkypeControlAPIAttach);
this->Discover_ID = RegisterWindowMessageW(this->SkypeControlAPIDiscover);
}

void InitSkypeThread(HWND WindowHandle)
{
static std::unique_ptr<std::thread> runnable(nullptr);

if (!runnable.get())
{
runnable.reset(new std::thread(&InitSkypeThread, WindowHandle));
runnable.get()->detach();
}
}

LRESULT __stdcall WindowProcedure(HWND Hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
static SkypeAPI api(Hwnd);

switch (Msg)
{
case WM_CREATE:
{
api.Connect();
}
break;

case WM_COPYDATA:
{
if (wParam == reinterpret_cast<WPARAM>(api.GetSkypeHandle()))
{
COPYDATASTRUCT* DataStruct = reinterpret_cast<COPYDATASTRUCT*>(lParam);
char* Response = static_cast<char*>(DataStruct->lpData);
std::cout<<Response<<"\n";
return 1;
}
}
break;

case WM_DESTROY:
PostQuitMessage(0);
return 0;

default:
if (Msg == api.GetAttachedID())
{
SkypeAPI::ATTACH_STATUS status = static_cast<SkypeAPI::ATTACH_STATUS>(lParam);
if (status == SkypeAPI::ATTACH_STATUS::SUCCESS)
{
api.SetSkypeHandle(reinterpret_cast<HWND>(wParam));
std::cout<<"Connection: Successful.\n";
}
else if (status == SkypeAPI::ATTACH_STATUS::PENDING)
{
std::cout<<"Connection: Pending.\n";
}
else if (status == SkypeAPI::ATTACH_STATUS::REFUSED)
{
std::cout<<"Connection: Refused.\n";
}
else if (status == SkypeAPI::ATTACH_STATUS::UNAVAILABLE)
{
std::cout<<"Connection: Unavailable.\n";
}
else if (status == SkypeAPI::ATTACH_STATUS::AVAILABLE)
{
std::cout<<"Connection: Available.\n";
}
else
{
std::cout<<"Connection: Status-Unknown.\n";
}
return 1;
}

return DefWindowProcW(Hwnd, Msg, wParam, lParam);
}
return 0;
}

int InitWindow()
{
WNDCLASSEXW WndClass = {0};
WndClass.cbSize = sizeof(WndClass);
WndClass.lpfnWndProc = WindowProcedure;
WndClass.lpszClassName = L"SkypeHook";
WndClass.hInstance = GetModuleHandleW(nullptr);

if(RegisterClassExW(&WndClass))
{
MSG Messages = {0};
CreateWindowExW(0, L"SkypeHook", nullptr, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, HWND_MESSAGE, nullptr, GetModuleHandleW(nullptr), nullptr);

while(true)
{
if (PeekMessageW(&Messages, nullptr, 0, 0, PM_REMOVE) > 0)
{
if (Messages.message != WM_QUIT)
{
TranslateMessage(&Messages);
DispatchMessageW(&Messages);
continue;
}
break;
}
else
{
Sleep(100);
}
}
return Messages.wParam;
}
return 0;
}

int main()
{
InitWindow();
return 0;
}



Lucidity

2014-07-03 22:51:14

Procedure scriptCrashAlert;
begin
PlaySound('C:/Simba/CrashSound.wav');
end;

if not (whateverDidntHappen) then
scriptCrashAlert;
players[CurrentPlayer].Logout;
Terminatescript

However, I totally like the idea of messaging you on skype because I'm constantly checking my phone and Skype