Jump to content
McKay Development

How can I create an event?


PonyExpress

Recommended Posts

I would like to manually create an event. How should I do this?

For example, I want to create an event in which the program will work just like that if it receives a message.

I think I should have 2 options: handling multiple event events or creating an event. I think both options should work something like this:

var message = {};
 
client.on("friendMessage", (SENDERMSG=> {
//   If an event or variable is not empty:
//  (client.on("friendMessage", (SENDER, MSG)) || (message != {}) => {
 
    if (message) {
        SENDER = message.msg;
        MSG = message.sid;
        message = {};
    }
 
    client.chatMessage(SENDER"OK");
});
 
message = {sid: { universe: 1type: 1instance: 1accountid: 12345678 }, msg: "test"};
 
// Something like event creation:
// client.on("friendMessage", SENDER: { universe: 1, type: 1, instance: 1, accountid: 23587203 }, MSG: "test");
Link to comment
Share on other sites

4 hours ago, PonyExpress said:

Thank you, it looks like what I need.

But I can’t figure out how to do it.

client.emit('friendMessage'new SteamID('76561197983852931'), "help");

Like I said before, what are you trying to achieve?

Are you trying to simulate the friendMessage event?

Link to comment
Share on other sites

Yes. I'm trying to simulate the friendMessage event. I want to use it like this:

client.on("friendMessage", (SENDERMSGFROM_NEW_OFFEROFFER=> {
    // or: client.on("friendMessage", (SENDER, [MSG, FROM_NEW_OFFER, OFFER]) => {
        if (MSG == "help") {
            // to do something
            if (FROM_NEW_OFFER) {
                OFFER.to_do_something();
            }
        }
    });
    
    manager.on("newOffer", (OFFER=> {
        client.emit('friendMessage'OFFER.partner"help""FROM_NEW_OFFER"OFFER);
    });

I know I can do it, but I don’t want to:

 

    client.on("friendMessage", (SENDERMSG=> {
        if (MSG == "help") {
            Help(SENDERMSG);
        }
    });
    
    manager.on("newOffer", (OFFER=> {
        Help(OFFER.partner"help""FROM_NEW_OFFER"OFFER);
    });
    
    function Help(SENDERMSGFROM_NEW_OFFEROFFER) {
        if (MSG == "help") {
            // to do something
            if (FROM_NEW_OFFER) {
                OFFER.to_do_something();
            }
        }
    }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...