These are chat archives for ikkentim/SampSharp

23rd
Feb 2017
Florian van Dillen
@fvandillen
Feb 23 2017 17:13
Does anyone have a good UI library here?
For textdraws, that is
I am working on a ingame map editor:D
Just created a script that pulls tweets from the twitter api by hashtag and streams them to an ingame billboard
Michael Kilpatrick
@NewbProgramming
Feb 23 2017 17:38
Kinda, I based mine on Unity but its flaw it's redrawn to accommodate the hierarchy system each time a textdraw is displayed.
I used Tweetinvi so players can send tweets to my twitter account :P
Tim Potze
@ikkentim
Feb 23 2017 17:52
I kinda didn't have much time to finish mine :/
Florian van Dillen
@fvandillen
Feb 23 2017 20:27
Hmm, ran into a little snag with objects
Probably my own fault but it's snapping to the wrong object when editting
Florian van Dillen
@fvandillen
Feb 23 2017 20:38
@ikkentim went debugging, turns out this might not be my fault xD
[Command("editobject")]
        public static void editObject(Player player, int id)
        {
            if (player.Account.Developer)
            {
                if (player.EdittingMap == null) return; // Error, no map selected.

                player.SendClientMessage(Color.LawnGreen, "Parameter: " + id + " - Editting map ID: " + player.EdittingMap.Id);
                player.SendClientMessage(Color.LawnGreen, "Objects of currently selected map:");
                foreach(var test in player.EdittingMap.Objects)
                {
                    player.SendClientMessage(Color.LawnGreen, test.Id + " - Model: " + test.ModelId);
                }

                var obj = player.EdittingMap.Objects.Where(o => o.Id == id).FirstOrDefault();

                obj.Object.Edit(player);

                obj.Object.Edited += (sender, args) =>
                {
                    if (args.Response == EditObjectResponse.Final)
                    {
                        using (ISession database = db.OpenSession())
                        {
                            using (var tx = database.BeginTransaction())
                            {
                                obj.PosX = args.Position.X;
                                obj.PosY = args.Position.Y;
                                obj.PosZ = args.Position.Z;
                                obj.RotX = args.Rotation.X;
                                obj.RotY = args.Rotation.Y;
                                obj.RotZ = args.Rotation.Z;
                                database.Update(player.EdittingMap);
                                tx.Commit();
                                player.SendClientMessage(Color.LawnGreen, "Object saved successfully!");
                            }
                        }
                    }
                };
            }
As you can see, the model of the object it tried to edit is 1328
Which is the modelid of the trashcan
However when calling edit on that object, it edits the billboard (which is a dynamic object in a completely different collection - the billboards collection)
And when calling edit on my billboard, it snaps to the trashcan XD
Everything works as intended, however the DynamicObject.Edit function messes up ID's internally
So you might want to look at that
Michael Kilpatrick
@NewbProgramming
Feb 23 2017 23:51
nHibernate still looks like alien programming to me, even though I've seen the examples from you like 5 times.