GUI for TBAmud

  • Ornir
  • Ornir's Avatar
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Co-owner of Luminari
More
11 months 1 week ago #7192 by Ornir
Replied by Ornir on topic GUI for TBAmud
It is actually an array of tables. Let me show you some example output:
{
  {
    LOCATION = "Wisdom",
    NAME = "wisdom",
    MODIFIER = "4",
    DURATION = "459",
    TYPE = "Untyped"
  },
  {
    LOCATION = "Strength",
    NAME = "strength",
    MODIFIER = "8",
    DURATION = "458",
    TYPE = "Enhancement"
  },
  {
    LOCATION = "<None>",
    NAME = "detect invisibility",
    MODIFIER = "0",
    DURATION = "1032",
    TYPE = "Untyped"
  },
  {
    LOCATION = "<None>",
    NAME = "fly",
    MODIFIER = "0",
    DURATION = "582",
    TYPE = "Untyped"
  },
  {
    LOCATION = "<None>",
    NAME = "water breathe",
    MODIFIER = "0",
    DURATION = "580",
    TYPE = "Untyped"
  },
  {
    LOCATION = "<None>",
    NAME = "mirror image",
    MODIFIER = "0",
    DURATION = "278",
    TYPE = "Untyped"
  },
  {
    LOCATION = "<None>",
    NAME = "blur",
    MODIFIER = "0",
    DURATION = "277",
    TYPE = "Untyped"
  },
  {
    LOCATION = "Damage-Reduction",
    NAME = "shadow shield",
    MODIFIER = "0",
    DURATION = "127",
    TYPE = "Untyped"
  },
  {
    LOCATION = "Resist-Negative",
    NAME = "shadow shield",
    MODIFIER = "100",
    DURATION = "127",
    TYPE = "Resistance"
  },
  {
    LOCATION = "Armor-Class",
    NAME = "shadow shield",
    MODIFIER = "5",
    DURATION = "127",
    TYPE = "Shield"
  }
}

As you can see, it is an array of table structures. This is how Mudlet converts the MSDP data coming from the MUD into lua table format.

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #7193 by Krell
Replied by Krell on topic GUI for TBAmud
Yes, my wording was poor but I understand the concept and had to abuse myself of the concept in order to use it. I don't think I could have successfully started using msdp in my local copy of the mud if I didn't. :)

See my old post with now somewhat depreciated code wrt to my own codebase.
tbamud.com/forum/4-development/3955-msdp-exit-display

My question was, worded more properly here, why did you NOT send your set of values to msdp_update()? Was there a design consideration? I'm asking because I want to know if there is a good reason to do it your way and possibly emulate it.

Please Log in or Create an account to join the conversation.

  • Ornir
  • Ornir's Avatar
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Co-owner of Luminari
More
11 months 1 week ago #7194 by Ornir
Replied by Ornir on topic GUI for TBAmud
Ah I think I understand.

I actually call this function from msdp_update(). To be honest I should move the flush outside the function and make that the responsibility of the caller!

I prefer to put things like this in their own functions - when you call the msdp set* functions, it queues up the data in the MSDP structure. Msdp_update runs once a second or so and queues up data and sends any changed data.

If you flush, it sends the data immediately!

Think of the MSDP structures as a buffer that is flushed on regular intervals. You can flush it manually to send the currently changed data. I like to see data change as immediately as possible so I flush often.

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #7195 by Krell
Replied by Krell on topic GUI for TBAmud
Thanks Ripley.

I recall requiring msdp_update() free the array of tables with how I set it up. It required manual tracking so that I remembered to have msdp_update() do the freeing, probably a consequence if me declaring my function type as *char. Perhaps I should consider using a void function instead?

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
11 months 1 week ago #7203 by WhiskyTest
Replied by WhiskyTest on topic GUI for TBAmud
There are a couple of instances you'd want immediate updates sent to the client, so splitting the relevant portion out into a function is helpful. Otherwise you'd be calling the whole msdp_update() unnecessarily.

For AFFECTS it probably isn't as important. But take, for example, map data like ROOM_VNUM.
Example:
You move north and immediately you are in VNUM 100, "Main Street".
After one second msdp_update() fires and sends the new data to your Mud Client.
Your mapper updates and is happy.

Next you quickly move north, north, north.
You are in VNUM 103, "Third Street" (boring Mud, I know)
Because msdp_update() is firing every second, your Mud Client doesn't know about 101 or 102 because you went through them so fast.
In this case you'd want to call the function to refresh the msdp data for exits whenever the char_to_room() function is called.

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago - 11 months 1 week ago #7204 by Krell
Replied by Krell on topic GUI for TBAmud
I don't know why you're telling me this. I have separate functions to create my tables and returns the values to msdp_update(). What's going on that I'm missing?

Addendum

Oh nvm, I think I see what you're saying. You're explaining why the function would return directly to the client and not the msdp_update() function. Got it.
Last edit: 11 months 1 week ago by Krell.

Please Log in or Create an account to join the conversation.

  • Ornir
  • Ornir's Avatar
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Co-owner of Luminari
More
11 months 1 week ago #7205 by Ornir
Replied by Ornir on topic GUI for TBAmud
The important part is:

MSDPSetArray(ch->desc, eMSDP_AFFECTS, msdp_buffer);

This adds a copy of msdp_buffer to the msdp buffer internal to the protocol snippet. At this point the work is done and the next time msdp_update() runs the data is sent. Alternatively You can flush as described above and the data is sent immediately.

No strings to return, nothing to free, life is good and I still have my hair!

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100

Please Log in or Create an account to join the conversation.

More
11 months 6 days ago #7213 by Sascha
Replied by Sascha on topic GUI for TBAmud
Hey Whiskey,

I responded to your post over on my boards regarding the GUI setup/implementation. Just wanted to call your attention to it. Thanks!

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...

Please Log in or Create an account to join the conversation.

Time to create page: 1.380 seconds