[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  Using Health_Bar_Miniwindow_Telnet and others.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Using Health_Bar_Miniwindow_Telnet and others.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2 

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Reply #15 on Sat 13 Feb 2010 03:08 PM (UTC)  quote  ]
Message
Use different WindowText calls. You can calculate the width a line takes and get the fonts height as well, thus decide where to wrap and print each line manually.

Everything is possible, but this is sadly not the easiest thing. It can quite easily be wrapped into a function though, but problem is that nearly everyone has slightly different wishes on how to wrap, how many lines to show maximum, and so forth.
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #16 on Sat 13 Feb 2010 03:20 PM (UTC)  quote  ]
Message
Alright thanks! I'll see what I can figure out here.
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #17 on Sat 13 Feb 2010 04:39 PM (UTC)  quote  ]
Message
Ok. I have this:


    WindowText (win, FONT_ID, string.format ("Plat  : %10.i  Bank Plat  : %10.i", t.plat, t.bpp), left, 5, 0, 0, ColourNameToRGB "white")	
    WindowText (win, FONT_ID, string.format ("Gold  : %10.i  Bank Gold  : %10.i", t.gold, t.bgp), left, 17, 0, 0, ColourNameToRGB "white")  
    WindowText (win, FONT_ID, string.format ("Silver: %10.i  Bank Silver: %10.i", t.silver, t.bsp), left, 29, 0, 0, ColourNameToRGB "white") 
    WindowText (win, FONT_ID, string.format ("Copper: %10.i  Bank Copper: %10.i", t.copper, t.bcp), left, 41, 0, 0, ColourNameToRGB "white") 


And this is pretty much how I want it, but if they have zero type coins on their person then it doesn't show 0, it just doesn' t show anything.

Example:

My char has 12 plat, 5 gold, and 3 copper on him. 4 gold in the bank.

It would show:


Plat  :      12  Bank Plat   :     
Gold  :       5  Bank Gold   :     4
Silver:          Bank Silver :      
Copper:       3  Bank Copper :    


I'd like it to show:


Plat  :      12  Bank Plat   :     0
Gold  :       5  Bank Gold   :     4
Silver:       0  Bank Silver :     0
Copper:       3  Bank Copper :     0


I tried to do t.bpp + 0 in the string.format but it still didn't show. Any thoughts?
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Reply #18 on Sat 13 Feb 2010 07:38 PM (UTC)  quote  ]
Message
Try %10i instead. Without the dot.
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #19 on Sun 14 Feb 2010 06:15 PM (UTC)  quote  ]
Message
Can I send too much data?

I added in a few more stats to put through into a plugin and I ended up messing up all my plugins. It wasn't until I took those changes out that my other plugins would work correctly again.

I added in 9 new arguments for the show_status, all ints, and it messed everything up. Could I be sending to much data or did I just mess up somewhere?
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #20 on Sun 14 Feb 2010 06:18 PM (UTC)  quote  ]
Message
Here is my show_status:


void show_status( CHAR_DATA *ch )
{

   if (WANT_TELNET_INFO (ch))
     {
     CHAR_DATA * victim = NULL;

     if (ch->fighting)
       victim = ch->fighting;

     char buf[MAX_STRING_LENGTH];
     snprintf(buf, sizeof (buf),
               "\xFF\xFA\x66"         // IAC SB 102
               "tt=\"status\";"       // transaction type: status
               "hp=%d;maxhp=%d;"      // hp points
               "move=%d;maxmove=%d;"  // movement
               "xp=%d;maxxp=%d;"      // experience
               "level=%d;"            // level
                "plat=%d;"              // plat on char
                "gold=%d;"              // gold on char
                "silver=%d;"            // silver on char
                "copper=%d;"            // copper on char
                "bpp=%d;"               // Bank Plat
                "bgp=%d;"               // Bank Gold
                "bsp=%d;"               // Bank Silver
                "bcp=%d;"               // Bank Copper
                "combat=%s;",           // Combat?
/*
                "hitroll=%d;"           // Hitroll
                "dualhitroll=%d;"       // Dual Wielding Hitroll
                "damroll=%d;"           // Damroll
                "dualdamroll=%d;"       // Dual Wielding Damroll
                "strength=%d;"          // Strength
                "wisdom=%d;"            // Wisdom
                "constitution=%d;"      // Constitution
                "intelligence=%d;"      // Intelligence
                "dexterity=%d;"         // Dexterity
                "armor=%d;"             // Armor
                "alignment=%d",         // Alignment
*/
               ch->hit,
               ch->max_hit,
               ch->move,
               ch->max_move,
               ch->exp,
               xp_for_level(ch,ch->level+1),
               ch->level,
               ch->coins[COIN_PP],
               ch->coins[COIN_GP],
               ch->coins[COIN_SP],
               ch->coins[COIN_CP],
                ch->pcdata->bank_coins[COIN_PP],
                ch->pcdata->bank_coins[COIN_GP],
                ch->pcdata->bank_coins[COIN_SP],
                ch->pcdata->bank_coins[COIN_CP],
                (ch->fighting && ch->fighting->fighting) ? "true" : "false"
/*
                get_hitroll(ch, WEAR_WIELD),
                get_hitroll(ch, WEAR_WIELD_2),
                get_damroll(ch, WEAR_WIELD_2),
                get_damroll(ch, WEAR_WIELD_2),
                get_curr_str(ch),
                get_curr_wis(ch),
                get_curr_con(ch),
                get_curr_int(ch),
                get_curr_dex(ch),
                GET_AC(ch),
                ch->alignment
*/
               );

      if (victim)
        {
         const char * p = "You";
         char * pName;

         if (ch != victim)
           {
           if (IS_NPC( victim ) )
             p = color_strip(victim->short_descr);
           else
             p = color_strip(victim->name);
           }

         pName = fixup_lua_strings (p);

         snprintf(&buf [strlen (buf)], sizeof (buf) - strlen (buf),
                 "victim={name=%s;" // name
                 "hp=%d;maxhp=%d;"      // hp points
                 "level=%d;"            // level
                 "};",
                 pName,
                 victim->hit,
                 victim->max_hit,
                 victim->level
               );
         free (pName);
       }

      //finish telnet negotiation after the combat info
      strncpy(&buf [strlen (buf)], "\xFF\xF0", sizeof (buf) - strlen (buf));  // IAC SE

      send_to_char( buf, ch );
     }

 }



The blocked out parts are what I added when it started messing up plugins.
[Go to top] top

Posted by Nick Gammon   Australia  (19,369 posts)  [Biography] bio   Forum Administrator
Date Reply #21 on Sun 14 Feb 2010 09:29 PM (UTC)  quote  ]
Message
I would be displaying what is received (by using the tprint in the plugin) to see if you are getting what you expect.

I can't directly test what you have done because I don't have things like get_hitroll in my version.

If the printf won't handle more than x variables (and I don't know if this is true or not) you could always just append the extra things like I did underneath where I appended extra stuff if you are fighting.

I would also check that the data type corresponds with what you have in the printf. For example, I thought that %d was used for a short, but if the data is long (eg. ch->pcdata->bank_coins) then it might throw things out.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #22 on Sun 14 Feb 2010 10:15 PM (UTC)  quote  ]
Message
Well, I just created a new function show_status_2 and put my new additions into it. Everything seems to be working fine now. What's the variable for long, you said %d is for short?

Also, is it possible to make these windows be able to detach from inside the world and be movable on the desktop? Like I have dual monitors I could float a window outside the mushclient?
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #23 on Sun 14 Feb 2010 10:21 PM (UTC)  quote  ]

Amended on Sun 14 Feb 2010 10:22 PM (UTC) by Twisol

Message
Orik said:
Also, is it possible to make these windows be able to detach from inside the world and be movable on the desktop? Like I have dual monitors I could float a window outside the mushclient?


That would be cool, but no. Miniwindows are simply script-drawn images rendered straight onto the output window itself. To create disassociated miniwindows, I suspect you'd need to give each one its own Windows window (though I don't know for sure), and the implementation of hotspot events would become markedly different. You might be able to extend MUSHclient across both monitors, and put your miniwindows in that space, though.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Orik   USA  (182 posts)  [Biography] bio
Date Reply #24 on Sun 14 Feb 2010 11:16 PM (UTC)  quote  ]

Amended on Sun 14 Feb 2010 11:17 PM (UTC) by Orik

Message
Hmm, ok.

I did find an old link that Nick had about a program he wrote that showed windows outside. I might maybe look at that some.

http://www.gammon.com.au/forum/?id=4951

Dunno if that's something I can use or not.

also, if you want to see what I've done so far, here's the links:

admud.com/download

You can connect to admud.com port 1999 and load those plugins to see them.
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #25 on Sun 14 Feb 2010 11:29 PM (UTC)  quote  ]
Message
Well, as Nick mentioned in that post, that plugin is actually written as a separate program altogether. A MUSHclient plugin is used to communicate between the two programs through a UDP socket connection. That's a perfectly valid approach, and indeed opens up its own unique possibilities, but it's entirely different from miniwindows.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,369 posts)  [Biography] bio   Forum Administrator
Date Reply #26 on Sun 14 Feb 2010 11:37 PM (UTC)  quote  ]
Message
You could conceivably open an entire new instance of MUSHclient on your separate monitor, and send stuff from the main one to the extra one using UDP packets (or some other method). Then the second instance could still use miniwindows, if you are comfortable using them.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,369 posts)  [Biography] bio   Forum Administrator
Date Reply #27 on Sun 14 Feb 2010 11:38 PM (UTC)  quote  ]
Message
Orik said:

Well, I just created a new function show_status_2 and put my new additions into it. Everything seems to be working fine now. What's the variable for long, you said %d is for short?


From memory, %ld (L-D not one-D) for a long, and %i for an int.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


6,857 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]