Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Welcome Bot
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Altercationz" data-source="post: 427944" data-attributes="member: 59038"><p>Hi,</p><p>To celebrate my returning back to retros (not something i'm proud of, bored to death lately) but enough of me let's get to the release.</p><p>I was on a hotel recently where they had a welcome bot which appears in your first room and greets you.</p><p>I loved the idea and the bot can be set to do pretty much anything which is why it's quite unique.</p><p></p><p>This probably isn't how the developer of the hotel I found it on did it but it does the job that's for sure.</p><p>The bot ID is randomly generated everytime a new player creates a room and this is checked by determining the users room count having it be less than 0 will send them the bot to welcome them, the method creates a new thread which holds the timer and kicks the bot out after a minute which is enough time for him to welcome the new player, if you think otherwise it can easily be changed.</p><p></p><p>This can be placed anywhere, I just threw it in Habbo.cs</p><p>[CODE]</p><p>public void CheckFirstRoom(GameClient User)</p><p> {</p><p> if (User.GetHabbo().UsersRooms.Count > 0)</p><p> {</p><p> return; // Already has a room.</p><p> }</p><p> else</p><p> {</p><p></p><p> // Bot Timer.</p><p> TimeSpan BotSent = DateTime.Now - BotDeployed;</p><p> WelcomeBotDeployed = true;</p><p></p><p> //Execute.</p><p> Room NewRoom;</p><p> Bot Noob = null;</p><p> int X = 3 - 10;</p><p> int Y = 3 - 10;</p><p></p><p> // Bot Id Randomizer.</p><p> Random Random = new Random();</p><p> int BotId = Random.Next(1, 9999);</p><p></p><p> List<RandomSpeech> Speech = new List<RandomSpeech>();</p><p></p><p> NewRoom = User.GetHabbo().CurrentRoom;</p><p> RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, User.GetHabbo().CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null);</p><p> Bot.Chat("Welcome to the hotel!", false, 0);</p><p> // Have the bot do whatever else you wish here.</p><p></p><p> new Thread(() => Thread.Sleep(60000));</p><p> if (WelcomeBotDeployed)</p><p> // Bot has greeted new player, time to greet some more lets get rid of him!</p><p> NewRoom.GetRoomUserManager().RemoveBot(Noob.Id, true);</p><p> WelcomeBotDeployed = false;</p><p> }</p><p> }[/CODE]</p><p>Then the following code to be pasted in the create room method in the RoomManager.cs</p><p>[CODE]Session.GetHabbo().CheckFirstRoom(Session); // Send bot to new room to greet the user.[/CODE]</p><p></p><p>It's as easy as that, enjoy.</p><p>"Giving credit where credit is due is a very rewarding habit to form. Its rewards are inestimable." - Loretta Young</p><p></p><p>The idea was taken from Hebbo Hotel.</p><p></p><p><strong><u>The code above is not efficient enough so use the one below!</u></strong></p><p>[CODE]internal void WelcomeBot()</p><p> {</p><p> if (WelcomeTask != null)</p><p> {</p><p> WelcomeTask.Dispose();</p><p> }</p><p></p><p> if (WelcomeTimer != null)</p><p> {</p><p> WelcomeTimer.Dispose();</p><p> }</p><p></p><p> if (this.UsersRooms.Count < 0 && WelcomeBotDeployed)</p><p> {</p><p> return; // User has created a room already / or had the bot deployed.</p><p> }</p><p> else</p><p> {</p><p> WelcomeBotDeployed = true; // set in database forever. bool (0/1)</p><p></p><p> // Execute.</p><p> Room NewRoom = this.CurrentRoom;</p><p> Bot Noob = null;</p><p> int X = 3 - 10;</p><p> int Y = 3 - 10;</p><p></p><p> // Bot Id Randomizer.</p><p> Random Random = new Random();</p><p> int BotId = Random.Next(1, 9999);</p><p></p><p> List<RandomSpeech> Speech = new List<RandomSpeech>();</p><p></p><p> RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, this.CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null);</p><p> Bot.Chat("Welcome to the hotel!", false, 0);</p><p> // Have the bot do whatever else here.</p><p></p><p> WelcomeTimer = new System.Timers.Timer();</p><p> WelcomeTimer.AutoReset = false;</p><p> WelcomeTimer.Elapsed += WelcomeBot_Elapsed;</p><p> WelcomeTimer.Interval = 60000; // time until the bot is kicked.</p><p></p><p> WelcomeTask = new System.Threading.Tasks.Task(WelcomeTimer.Start);</p><p> WelcomeTask.Start();</p><p> }</p><p> }[/CODE]</p><p>[CODE]</p><p>private void WelcomeBot_Elapsed(object sender, System.Timers.ElapsedEventArgs e)</p><p> {</p><p> if (GetClient() == null)</p><p> {</p><p> WelcomeTask.Dispose();</p><p> WelcomeTimer.Dispose();</p><p> return;</p><p> }</p><p></p><p> Room Room = this.CurrentRoom;</p><p> foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())</p><p> {</p><p> if (User == null || !User.IsBot) // make sure you're removing the bot.</p><p> continue;</p><p></p><p> RoomUser Bot = null;</p><p> if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out Bot))</p><p> return;</p><p></p><p> Room.GetRoomUserManager().RemoveBot(Bot.VirtualId, true);</p><p> // end the timer and task.</p><p> WelcomeTask.Dispose();</p><p> WelcomeTimer.Dispose();</p><p> }</p><p> }[/CODE]</p><p>In the EnterRoom Method, "CheckFirstRoom" can be replaced with</p><p>[CODE]</p><p>WelcomeBot();[/CODE]</p><p>and you must put</p><p>[CODE]</p><p>public Timer WelcomeTimer;</p><p>public Task WelcomeTask;[/CODE]</p><p>in Habbo.cs</p></blockquote><p></p>
[QUOTE="Altercationz, post: 427944, member: 59038"] Hi, To celebrate my returning back to retros (not something i'm proud of, bored to death lately) but enough of me let's get to the release. I was on a hotel recently where they had a welcome bot which appears in your first room and greets you. I loved the idea and the bot can be set to do pretty much anything which is why it's quite unique. This probably isn't how the developer of the hotel I found it on did it but it does the job that's for sure. The bot ID is randomly generated everytime a new player creates a room and this is checked by determining the users room count having it be less than 0 will send them the bot to welcome them, the method creates a new thread which holds the timer and kicks the bot out after a minute which is enough time for him to welcome the new player, if you think otherwise it can easily be changed. This can be placed anywhere, I just threw it in Habbo.cs [CODE] public void CheckFirstRoom(GameClient User) { if (User.GetHabbo().UsersRooms.Count > 0) { return; // Already has a room. } else { // Bot Timer. TimeSpan BotSent = DateTime.Now - BotDeployed; WelcomeBotDeployed = true; //Execute. Room NewRoom; Bot Noob = null; int X = 3 - 10; int Y = 3 - 10; // Bot Id Randomizer. Random Random = new Random(); int BotId = Random.Next(1, 9999); List<RandomSpeech> Speech = new List<RandomSpeech>(); NewRoom = User.GetHabbo().CurrentRoom; RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, User.GetHabbo().CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null); Bot.Chat("Welcome to the hotel!", false, 0); // Have the bot do whatever else you wish here. new Thread(() => Thread.Sleep(60000)); if (WelcomeBotDeployed) // Bot has greeted new player, time to greet some more lets get rid of him! NewRoom.GetRoomUserManager().RemoveBot(Noob.Id, true); WelcomeBotDeployed = false; } }[/CODE] Then the following code to be pasted in the create room method in the RoomManager.cs [CODE]Session.GetHabbo().CheckFirstRoom(Session); // Send bot to new room to greet the user.[/CODE] It's as easy as that, enjoy. "Giving credit where credit is due is a very rewarding habit to form. Its rewards are inestimable." - Loretta Young The idea was taken from Hebbo Hotel. [B][U]The code above is not efficient enough so use the one below![/U][/B] [CODE]internal void WelcomeBot() { if (WelcomeTask != null) { WelcomeTask.Dispose(); } if (WelcomeTimer != null) { WelcomeTimer.Dispose(); } if (this.UsersRooms.Count < 0 && WelcomeBotDeployed) { return; // User has created a room already / or had the bot deployed. } else { WelcomeBotDeployed = true; // set in database forever. bool (0/1) // Execute. Room NewRoom = this.CurrentRoom; Bot Noob = null; int X = 3 - 10; int Y = 3 - 10; // Bot Id Randomizer. Random Random = new Random(); int BotId = Random.Next(1, 9999); List<RandomSpeech> Speech = new List<RandomSpeech>(); RoomUser Bot = NewRoom.GetRoomUserManager().DeployBot(new RoomBot(BotId, this.CurrentRoomId, "bartender", "freeroam", "Disguised", "Welcome!", Noob.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref Speech, "", 0, Noob.OwnerId, false, 0, false, 0), null); Bot.Chat("Welcome to the hotel!", false, 0); // Have the bot do whatever else here. WelcomeTimer = new System.Timers.Timer(); WelcomeTimer.AutoReset = false; WelcomeTimer.Elapsed += WelcomeBot_Elapsed; WelcomeTimer.Interval = 60000; // time until the bot is kicked. WelcomeTask = new System.Threading.Tasks.Task(WelcomeTimer.Start); WelcomeTask.Start(); } }[/CODE] [CODE] private void WelcomeBot_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (GetClient() == null) { WelcomeTask.Dispose(); WelcomeTimer.Dispose(); return; } Room Room = this.CurrentRoom; foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList()) { if (User == null || !User.IsBot) // make sure you're removing the bot. continue; RoomUser Bot = null; if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out Bot)) return; Room.GetRoomUserManager().RemoveBot(Bot.VirtualId, true); // end the timer and task. WelcomeTask.Dispose(); WelcomeTimer.Dispose(); } }[/CODE] In the EnterRoom Method, "CheckFirstRoom" can be replaced with [CODE] WelcomeBot();[/CODE] and you must put [CODE] public Timer WelcomeTimer; public Task WelcomeTask;[/CODE] in Habbo.cs [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Welcome Bot
Top