These are chat archives for ikkentim/SampSharp

25th
Jun 2015
Florian van Dillen
@fvandillen
Jun 25 2015 08:17
About the listdialog items, are you already inserting \n or is this code just to check if it is?
/// <summary> /// Gets the message displayed. /// </summary> public override string Message { get { return string.Join("\n", Items); } }
Because if it doesn't insert it, i'd say we do it automatically, saves a lot of time and provides cleaner code
Tim Potze
@ikkentim
Jun 25 2015 09:26
This code should automatically insert it
that's what that join does or should do
Lemme test...
It works just fine for me
        [Command("dialoglist")]
        [Text("items")]
        public static void DialogListCommand(GtaPlayer player, string items)
        {
            var dialog = new ListDialog("Captions", "OK!");

            foreach (var i in items.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)))
                dialog.Items.Add(i);

            dialog.Show(player);

            dialog.Response += (sender, args) =>
            {
                player.SendClientMessage("Response: " + args.ListItem);
            };
        }
Florian van Dillen
@fvandillen
Jun 25 2015 09:31
Ah, so I am pretty much typing the \n for nothing all the time xD
Tim Potze
@ikkentim
Jun 25 2015 09:32
xD
Florian van Dillen
@fvandillen
Jun 25 2015 09:32
manageInvitesDialog.Items.Add(invite.Username + "\n"); could simply be manageInvitesDialog.Items.Add(invite.Username);
Tim Potze
@ikkentim
Jun 25 2015 09:32
Yes.
Florian van Dillen
@fvandillen
Jun 25 2015 09:32
nice
Well apart from some nHibernate issues, i'm almost done with a sick group system then
Tim Potze
@ikkentim
Jun 25 2015 09:32
The framework should handle all annoying things so you can focus on the gamemode itself.
Nice
Florian van Dillen
@fvandillen
Jun 25 2015 09:33
Tim Potze
@ikkentim
Jun 25 2015 09:34
Nice :smile:
Florian van Dillen
@fvandillen
Jun 25 2015 09:34
features persistent invites, ranks, permissions, even for offline players
Tim Potze
@ikkentim
Jun 25 2015 09:34
Woa nice
Florian van Dillen
@fvandillen
Jun 25 2015 09:34
and the more secondary scripts such as properties, economy and vehicles have a simple way of hooking into it by doing player.hasPermission()
Tim Potze
@ikkentim
Jun 25 2015 09:34
I never got started too well with my gamemode yet
Sweet
Florian van Dillen
@fvandillen
Jun 25 2015 09:35
I think our perspectives differ when it comes to starting point
You probably started this because you love to build frameworks
I started this from the perspective of wanting to code one awesome server
Tim Potze
@ikkentim
Jun 25 2015 09:35
No not really, I had a running community and all, but my school got the better of me and sucked all my time up
Florian van Dillen
@fvandillen
Jun 25 2015 09:36
Let me try fixing the hibernate issue real quick and show you around on my public dev server
Oh bummer
Tim Potze
@ikkentim
Jun 25 2015 09:36
Community and all died out a little so I decided to shut it down
Florian van Dillen
@fvandillen
Jun 25 2015 09:36
I am on a dev project at work currently, a wordpress template which i am getting paid 3 weeks for, done in 2 days
Tim Potze
@ikkentim
Jun 25 2015 09:36
now I want to reboot it (and so do many old players), but I just lack the time
Florian van Dillen
@fvandillen
Jun 25 2015 09:36
so that leaves plenty of paid scripting :D
Sweet
if you need any help, let me know
Tim Potze
@ikkentim
Jun 25 2015 09:36
Thanks ! :)
I have some very basic shop robbery and inventory system
I was so frustrated when 0.3.7 came out lol
in my shop robbery system I connect NPCs to let them idle behind the counter
Florian van Dillen
@fvandillen
Jun 25 2015 09:38
Yeah, i loved the videos
Tim Potze
@ikkentim
Jun 25 2015 09:38
and then in 0.3.7 ( only a few weeks later) he added actors to do exactly that
Florian van Dillen
@fvandillen
Jun 25 2015 09:38
Wanna check out the group script? I just finished the hibernate issue, it seems
Tim Potze
@ikkentim
Jun 25 2015 09:38
Sure
Show me what you got :P IP?
Florian van Dillen
@fvandillen
Jun 25 2015 09:39
Your username is Tim and your password is test
Tim Potze
@ikkentim
Jun 25 2015 09:39
alright
Florian van Dillen
@fvandillen
Jun 25 2015 09:39
ip: server.trinityrpg.com:7777
Tim Potze
@ikkentim
Jun 25 2015 11:58
Currently releasing 0.6.0...
Florian van Dillen
@fvandillen
Jun 25 2015 11:58
Sweet!
Tim Potze
@ikkentim
Jun 25 2015 12:07
Done. Also released streamer extension 0.6.0.
Florian van Dillen
@fvandillen
Jun 25 2015 12:29
Nice, good work
Could you look at the OnPlayerText stuff if you have time? Or just tell me a way to rip out the sending behavior altogether, because all I need is the event anyway. All my chats are scripted.
Tim Potze
@ikkentim
Jun 25 2015 13:14
Gonna look into it
Can you try this?:
        protected override void OnPlayerText(GtaPlayer player, TextEventArgs e)
        {
            base.OnPlayerText(player, e);

            Console.WriteLine(e.SendToPlayers ? "[DEBUG] Player text was NOT handled." : "[DEBUG] Player text was handled.");
        }
Tim Potze
@ikkentim
Jun 25 2015 13:23
NVM bug happens here as well,, looking into it
Tim Potze
@ikkentim
Jun 25 2015 13:29
Changed nothing and now it doesn't happen anymore.. ? I don't get it yet.
Tim Potze
@ikkentim
Jun 25 2015 13:48
I think I've fixed it
Florian van Dillen
@fvandillen
Jun 25 2015 13:48
Will try when I am done working
What was the issue?
Tim Potze
@ikkentim
Jun 25 2015 13:52
Something C++ ish
ikkentim/SampSharp@2a3df78
I'm releasing a minor update to directly fix this.
Florian van Dillen
@fvandillen
Jun 25 2015 13:53
Awesome job!
Seems that the actual usage of the framework uncovered many bugs so far
Tim Potze
@ikkentim
Jun 25 2015 13:54
Yes, that's why I've not yet released v1.0
I promised myself that I'd release v1.0 when my server is up and running flawlessly
Or yours.
Florian van Dillen
@fvandillen
Jun 25 2015 13:55
Currently spending most of my free time on the script so it might be mine :D
The group system is now working flawlessly by the way
Most complex code in the entire gamemode, and only exposing one real function, player.hasPermission(permission, group);
Tim Potze
@ikkentim
Jun 25 2015 13:57
Ugh... Now my server is crashing.. Let's see what I broke
Florian van Dillen
@fvandillen
Jun 25 2015 14:42
What is the advantage of using DialogAsync by the way?
Tim Potze
@ikkentim
Jun 25 2015 15:04
You don't need to create delegates and stuff.
Consider this code:
        var dialog = new InputDialog("Hello", "Login please!", true, "Login", "Cancel");

        var timerToShowThingsWork = new Timer(1000, true);
        timerToShowThingsWork.Tick += (sender, args) =>
        {
            player.SendClientMessage("Things still work in the background!");
        };

        var response = await dialog.ShowAsync(player);

        player.SendClientMessage("Your input was {1}... Do we require a sync? {0}. So thats awesome! Lets move you up a lill. ", Sync.IsRequired, response.InputText);
        player.Position += new Vector3(0,1,0);

        timerToShowThingsWork.Dispose();
```

The timer is just to show that things still work in the background, so essentially, this is all you need:

var dialog = new InputDialog("Hello", "Login please!", true, "Login", "Cancel");
var response = await dialog.ShowAsync(player);

instead of

var dialog = new InputDialog("Hello", "Login please!", true, "Login", "Cancel");
dialog.Response += (sender, args) => {
//....
};
It does however mean that the methods needs to be async, but that shouldn't be a problem.
Response of the first code: