[R26][HOLO] Customisable Commands [TUT]

Benson

Member
Oct 13, 2010
57
3
Heeeellooooo!

Well, this tutorial has never been written or released before, but I earlier on I was having fun around on an R63 phoenix server, I found some new commands such as "o/", as I don't do the new flash servers, I stick to shockwave, I found a way to make these commandments work on an R26.

All you need is a few simple edits in virtualUser.cs, make sure you keep a backup, though - just incase you make a mistake!

---------------------------------------
What you need:
- Holograph Emulator R26 - example: TDbP, Handyandy160's edit, Dissi's edit.
- A brain and common sense
---------------------------------------

1. Open up virtualUser.cs in Microsoft Visual C# 2008 / 2010.
2. Find the string:
Code:
case "@w":
3. You should've found something almost like this, or exactly in some cases.
Code:
                        case "@w": // Chat - shout
                            {
                                try
                                {
                                    if (_isMuted == false && (Room != null && roomUser != null))
                                    {
                                        string Message = currentPacket.Substring(4);
                                        userManager.addChatMessage(_Username, _roomID, Message);
                                        Message = stringManager.filterSwearwords(Message);
                                        if (Message.Substring(0, 1) == ":" && isSpeechCommand(Message.Substring(1))) // Speechcommand invoked!
                                        {
                                            if (roomUser.isTyping)
                                            {
                                                Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
                                                roomUser.isTyping = false;
                                            }
                                        }
                                        else
                                        {
                                            if (currentPacket.Substring(1, 1) == "w") // Shout
                                            {
                                                Room.sendShout(roomUser, Message);
                                            }
                                            else
                                            {
                                                Room.sendSaying(roomUser, Message);
                                                //Out.WriteChat("Say", _Username, Message); 
                                            }
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    Out.WriteError(e.ToString());
                                }
                                break;
                            }

4. Search for this start of a function:
Code:
private bool isSpeechCommand

5. Above the found string 'private bool isSpeechCommand', add the below code snippet.
Code:
private bool isCustomCommand(string Text)
{
     switch (Text.ToLower()) {
          case "o/":
               Out.WriteLine(_Username + " has sent a special action command 'wave'");
               if (Room != null && roomUser != null && statusManager.containsStatus("wave") == false)
               {
                    statusManager.removeStatus("dance");
                    statusManager.handleStatus("wave", "", Config.Statuses_Wave_waveDuration);
                }
          break;
     }
}

6. Now that we have the custom command function implemented, we need to make it so we can pick it up with the chat case.

7. Find the string (yes, again)
Code:
case "@w":

8. Add this to it (read next step to see where it goes):
Code:
                                        }else if (isCustomCommand(Message))
                                        {
                                            if (roomUser.isTyping)
                                            {
                                                Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
                                                roomUser.isTyping = false;
                                            }
                                        }

9. The code under 'case "@w":' should now look like this:
Code:
                        case "@w": // Chat - shout
                            {
                                try
                                {
                                    if (_isMuted == false && (Room != null && roomUser != null))
                                    {
                                        string Message = currentPacket.Substring(4);
                                        userManager.addChatMessage(_Username, _roomID, Message);
                                        Message = stringManager.filterSwearwords(Message);
                                        if (Message.Substring(0, 1) == ":" && isSpeechCommand(Message.Substring(1))) // Speechcommand invoked!
                                        {
                                            if (roomUser.isTyping)
                                            {
                                                Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
                                                roomUser.isTyping = false;
                                            }
                                        }else if (isCustomCommand(Message))
                                        {
                                            if (roomUser.isTyping)
                                            {
                                                Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
                                                roomUser.isTyping = false;
                                            }
                                        }
                                        else
                                        {
                                            if (currentPacket.Substring(1, 1) == "w") // Shout
                                            {
                                                Room.sendShout(roomUser, Message);
                                            }
                                            else
                                            {
                                                Room.sendSaying(roomUser, Message);
                                                //Out.WriteChat("Say", _Username, Message); 
                                            }
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    Out.WriteError(e.ToString());
                                }
                                break;
                            }

10. Debug and run!
----------------------------
100% credits to me (Benson)
If you wish to spread this, please do so, but please give me fullcredit!

If you encounter any problems or errors, please reply the error and a screenshot.
Thanks for reading, please thank me if i've helped, or this is a good tutorial :)
 

Users who are viewing this thread

Top