Welcome to the Builder Academy

Question GUI for TBAmud

More
02 Dec 2017 21:27 #7181 by krell
Replied by krell on topic GUI for TBAmud
Nice. Thanks WhiskyTest.

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

More
04 Dec 2017 14:59 #7190 by krell
Replied by krell on topic GUI for TBAmud
I noticed that you set your array inside of the function rather than passing it to msdp_update(). Is there a specific design decision you chose to do it this way?

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

More
04 Dec 2017 15:56 #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:
Code:
{ { 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
04 Dec 2017 16:42 #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.

More
04 Dec 2017 16:56 #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
04 Dec 2017 17:53 #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.

Time to create page: 0.194 seconds