Terrible Holograph one way doors snippet.

Status
Not open for further replies.
RaGEZONE VETERAN
Joined
Aug 9, 2007
Messages
410
Reaction score
13
Hello there. Today is the day that I am quitting owning a Habbo retro. I will continue to maybe develop with Holograph and ION, but I will no longer be owning a hotel, therefore I will make all of my (terribly coded) snippets public.

I really don't care if this should be posted in the Holograph thread, people don't always look in the Holograph thread. I will offer no support for this snippet, if you can't get it to work with my instructions below then you must be an idiot.

Instructions to install


  1. Copy the snippet to your clipboard
  2. Open your Holograph virtualuser.cs
  3. Search for "love shuffler" or somthing similar
  4. Under the "love shuffler" case, paste my one way door case
  5. Add the one way door to the catalogue, it should work buggily
Now I know this is terribly coded. I could work much more efficient and yes, I have improved since I coded this, but I'm just helping the community by releasing this. Also, you can obviously add support for multiple one way door casts, if you know what I mean. If you don't, worry not.

The snippet
Code:
                        case "Ch": // Ch + ONE-WAY-DOOR-FURNI-ID (answer: Dx + WIRE(FURNI-ID) + I + WIRE(ROOM-UID-OF-CLICKER)) (sprite: 'one_way_door*#)
                            {
                                try
                                {
                                int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
                                if (Room.floorItemManager.containsItem(itemID))
                                {
                                    Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the itemID.
                                    if (Item.Sprite == "one_way_door*1")
                                    {
                                        Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "I" + Encoding.encodeVL64(Room.roomID)); // Opens the gate, with green light
                                        Room.moveUser(this.roomUser, Item.X, Item.Y, true); // Walk into the item
                                        
                                        Thread.Sleep(350);

                                             if (Item.Z == 0)
                                            Room.moveUser(this.roomUser, roomUser.X, roomUser.Y+1, true);
                                        else if (Item.Z == 2)
                                            Room.moveUser(this.roomUser, roomUser.X-1, roomUser.Y, true);
                                        else if (Item.Z == 4)
                                            Room.moveUser(this.roomUser, roomUser.X, roomUser.Y-1, true);
                                        else if (Item.Z == 6)
                                            Room.moveUser(this.roomUser, roomUser.X+1, roomUser.Y, true);

                                        Thread.Sleep(350);
                                        Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "H" + Encoding.encodeVL64(Room.roomID));
                                    }
                                }
                                }
                        catch { }
                                break;
                            }

Enjoy, TomSpit.

Moogly Edit...

Here's the SQL as posted by Ricky:
catalogue_pages
Code:
INSERT INTO `catalogue_pages` (`indexid`, `minrank`, `indexname`, `displayname`, `style_layout`, `img_header`, `img_side`, `label_description`, `label_misc`, `label_moredetails`, `opt_bodyreplace`) VALUES
(CIP, 7, 'One Way Doors', 'One Way Doors', 'ctlg_layout2', 'catalog_limited_headline1', 'catalog_limited_teaser1,', 'New SciFi Furni', NULL, 'Click on the item you want for more information.', 'NULL');
catalogue_items
Code:
INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_description`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `catalogue_id_index`) VALUES
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*1', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*2', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*3', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*4', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*5', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*6', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*7', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*8', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*9', '0,0,0', CIP, '0', '1', '1', CID);
No problem.
 
Last edited by a moderator:
I think its pretty awesome.. but does they work as they should? like since you say terrible in the thread title too, or is it just the coding that could have been done beter? :)
 
Oh god, don't use thread sleep!!!!!! It stops the whole server. Plus if the user clickson the gates 10 times, it multiply's it by 10, so the server stops for 3500 seconds and so on.

Instead put a timer on the sendData. eg sendData("Dx" + "HH", 350);

I got one way gates working, well the opening and closing + walking parts, but I need to work on the square open and square blocked bits :)
 
Oh god, don't use thread sleep!!!!!! It stops the whole server. Plus if the user clickson the gates 10 times, it multiply's it by 10, so the server stops for 3500 seconds and so on.

Instead put a timer on the sendData. eg sendData("Dx" + "HH", 350);

I got one way gates working, well the opening and closing + walking parts, but I need to work on the square open and square blocked bits :)
I told you it was terribly coded ;)
 
Do it likes this ;)

Code:
                        case "Ch": // Ch + ONE-WAY-DOOR-FURNI-ID (answer: Dx + WIRE(FURNI-ID) + I + WIRE(ROOM-UID-OF-CLICKER)) (sprite: 'one_way_door*#)
                            {
                                try
                                {
                                int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
                                if (Room.floorItemManager.containsItem(itemID))
                                {
                                    Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the itemID.
                                    if (Item.Sprite == "one_way_door*1")
                                    {
                                        Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "I" + Encoding.encodeVL64(Room.roomID)); // Opens the gate, with green light
                                        Room.moveUser(this.roomUser, Item.X, Item.Y, true); // Walk into the item
                                        

                                             if (Item.Z == 0)
                                            Room.moveUser(this.roomUser, roomUser.X, roomUser.Y+1, true);
                                        else if (Item.Z == 2)
                                            Room.moveUser(this.roomUser, roomUser.X-1, roomUser.Y, true);
                                        else if (Item.Z == 4)
                                            Room.moveUser(this.roomUser, roomUser.X, roomUser.Y-1, true);
                                        else if (Item.Z == 6)
                                            Room.moveUser(this.roomUser, roomUser.X+1, roomUser.Y, true);
                                        Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "H" + Encoding.encodeVL64(Room.roomID), 350);
                                    }
                                }
                                }
                        catch { }
                                break;
                            }

Also does the user walk onto the gate?
 
Can someone post the sql of catalogue_items and catalogue_pages?
for one_way_doors?

Thanks, Mark
catalogue_pages
Code:
INSERT INTO `catalogue_pages` (`indexid`, `minrank`, `indexname`, `displayname`, `style_layout`, `img_header`, `img_side`, `label_description`, `label_misc`, `label_moredetails`, `opt_bodyreplace`) VALUES
(CIP, 7, 'One Way Doors', 'One Way Doors', 'ctlg_layout2', 'catalog_limited_headline1', 'catalog_limited_teaser1,', 'New SciFi Furni', NULL, 'Click on the item you want for more information.', 'NULL');
catalogue_items
Code:
INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_description`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `catalogue_id_index`) VALUES
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*1', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*2', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*3', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*4', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*5', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*6', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*7', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*8', '0,0,0', CIP, '0', '1', '1', CID),
(TID, 'NAME', 'DESC', 5, 1, 1, 1, 0.00, 'one_way_door*9', '0,0,0', CIP, '0', '1', '1', CID);
No problem.
 
Code:
  if (Item.Sprite == "one_way_door*1")

Am I right in thinking that should be...

Code:
 if (Item.Sprite == "one_way_door*1" || Item.Sprite == "one_way_door*2" || Item.Sprite == "one_way_door*3" || Item.Sprite == "one_way_door*4" || Item.Sprite == "one_way_door*5" || Item.Sprite == "one_way_door*6" || Item.Sprite == "one_way_door*7" || Item.Sprite == "one_way_door*8" || Item.Sprite == "one_way_door*9")

Or something like that... fk noes I can't code in c# :P
 
Last edited:
Code:
  if (Item.Sprite == "one_way_door*1")
Am I right in thinking that should be...

Code:
 if (Item.Sprite == "one_way_door*1" || Item.Sprite == "one_way_door*2" || Item.Sprite == "one_way_door*3" || Item.Sprite == "one_way_door*4" || Item.Sprite == "one_way_door*5" || Item.Sprite == "one_way_door*6" || Item.Sprite == "one_way_door*7" || Item.Sprite == "one_way_door*8" || Item.Sprite == "one_way_door*9")
Or something like that... fk noes I can't code in c# :P
Yeah, somthing like that should work. I don't care what you guys do with it. Fix it up and release it, keep it and be a greedy faggot or whatever.
 
Na I'm bored so I'm thinking about messing with Holo.
I was making something in PHP but I can't be fucked with it now.

Great Job Anyway (Y)
 
TomSpit - Terrible Holograph one way doors snippet. - RaGEZONE Forums


Yeaah xD

... remove the "walk into item" or it dont works correctly.
But, my code is a bit diffrent, i coded it some months ago.

I don't know how to make walking smoothy...
 
Iv fixed a few little things iv noticed on yours =]

Code:
                        case "Ch": // Ch + ONE-WAY-DOOR-FURNI-ID (answer: Dx + WIRE(FURNI-ID) + I + WIRE(ROOM-UID-OF-CLICKER)) (sprite: 'one_way_door*#)
                            {
                                try
                                {
                                    int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
                                    if (Room.floorItemManager.containsItem(itemID))
                                    {
                                        Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the itemID.
                                        if (Item.Sprite == "one_way_door" || Item.Sprite == "one_way_door*1" || Item.Sprite == "one_way_door*2" || Item.Sprite == "one_way_door*3" || Item.Sprite == "one_way_door*4" || Item.Sprite == "one_way_door*5" || Item.Sprite == "one_way_door*6" || Item.Sprite == "one_way_door*7" || Item.Sprite == "one_way_door*8" || Item.Sprite == "one_way_door*9")

                                        {
                                            Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "I" + Encoding.encodeVL64(Room.roomID)); // Opens the gate, with green light
                                            Room.moveUser(this.roomUser, Item.X, Item.Y, true); // Walk into the item


                                            if (Item.Z == 0)
                                                Room.moveUser(this.roomUser, roomUser.X, roomUser.Y +2, true);
                                            else if (Item.Z == 2)
                                                Room.moveUser(this.roomUser, roomUser.X - 2, roomUser.Y, true);
                                            else if (Item.Z == 4)
                                                Room.moveUser(this.roomUser, roomUser.X, roomUser.Y - 2, true);
                                            else if (Item.Z == 6)
                                                Room.moveUser(this.roomUser, roomUser.X + 2, roomUser.Y, true);
                                            Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "H" + Encoding.encodeVL64(Room.roomID), 350);
                                        }
                                    }
                                }
                                catch { }
                                break;
                            }

1) Being the item thing as I pointed a few secs ago.
2) Being that it would only move the avatar into the gate and not through it.


Only bug I see now is when you try go threw it over and over and you just get stuck in the middle xD
 
Last edited:
I think I know why you "speed" through the gate.

Basically this is what habbo does: User double-clicks the one way gate. The gate opens. Pathfinder helps the user navigate through the gate. The gate closes.

This is how we're doing it: User double-clicks the one way gate. The gate closes. User is forced into the square the gate is in. User is forced out the gate. Gate closes in 350 miliseconds regardless of where the user is.

The reason why we can't use pathfinder to go through the gate is because the gate is considered a solid object which the pathfinder avoids. Is there any way to change the typeid of the gate temporary (to let's say 5 which is rug) allow the pathfinder to navigate the user through it, and change the type id back to 1 (solid).

P.S: Here's my current code (modified of Shine-Away's modification of TomSpit's):

Code removed. See my last post.

Basically it forces the user into the square, but lets the pathfinder find the way out, you only get "half-speedy" and half-normal walking. It also shuts down the gate in 700 miliseconds instead of 350 because normal-walking speed is slower.


EDIT: Here's my in-progress code to demostrate what I was talking about, right now, it does this: Open the gate, pathfinder tells the correct location, user walks around the gate, gate closes. If someone can make the gate temporary a non-solid object, it'll work 100%.

Code removed. See my last post.
 
Last edited:
Status
Not open for further replies.
Back