The Mudlet Crucible

Developer discussion around the system creation stack for Mudlet.
User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: The Mudlet Crucible

Post by Jules » Mon Jan 18, 2010 4:43 pm

Looks very good, and is an exceptional answer to this problem... Hell, I may even integrate this into Mantis, or something very similar to it. That is, if it's still under the MIT license, where I can take it and use it at my disgression! 8-)

User avatar
demonnic
Posts: 559
Joined: Sat Dec 05, 2009 3:19 pm

Re: The Mudlet Crucible

Post by demonnic » Mon Jan 18, 2010 6:31 pm

Objections? none at all... that's made of awesomesauce.

Nitro
Posts: 6
Joined: Thu Jan 21, 2010 2:44 pm

Re: The Mudlet Crucible

Post by Nitro » Thu Jan 21, 2010 2:56 pm

I was thinking about some generic form of balances. A balance class or something like that.

Code: Select all

balance_template =  {
name = "balanceName", -- Name for referring to it.
timeOut = 1, -- Time after which the balance is regained (in seconds), use 0 to disable automatic regaining.
timeOutEvent = "eventName", -- Event to be fired when balance times out, "" to call no event.
}
The system would automaticly create the neccesary timers for the balances.

You'd also have the functions:

loseBalance("balanceName") -- Sets the balance to false and starts the time-out timer.
regainBalance("balanceName") -- Makes you regain the balance, and stop the time-out timer.
hasBalance("balanceName") -> true/false

Wingard
Posts: 9
Joined: Thu Jan 14, 2010 6:41 pm

Re: The Mudlet Crucible

Post by Wingard » Sun Jan 24, 2010 10:14 pm

Balances aren't really that simple. Different things take balance for different amounts of time, so a timer wouldn't really work. Not to mention afflictions that slow balance recovery, and varying balance times between different classes/races/etc.

ixokai
Posts: 63
Joined: Fri Dec 25, 2009 7:43 am

Re: The Mudlet Crucible

Post by ixokai » Mon Jan 25, 2010 12:13 am

I agree that they aren't that simple; I don't think a timer can be a functional way of tracking these sorts of things.

On IRE games at least, it appears there's always a notification when you "regain" the slot (what I'm calling generic-balances), I don't know if that holds for others. Triggers therefore seem to be the only way to reliably track a slot being used and becoming available again-- it breaks down when someone suffers lag, but I don't think a generic system can try to protect you from lag.

Nitro
Posts: 6
Joined: Thu Jan 21, 2010 2:44 pm

Re: The Mudlet Crucible

Post by Nitro » Mon Jan 25, 2010 10:57 am

That's why you would have the function regainBalance("balanceName") which can simply be triggered on the balance regain message, e.g. "You may drink another potion.". The timer part of the balance is to protect against illusions/things that mess up a certain healing method. It will basicly ensure that IF you haven't received the balance regain message after a certain time period, it will reset the balance, and thus preventing your curing script from locking up. If you don't want automatic balance regaining, you can always set the balance delay to 0. Ideally you want the balance regain delay to be a little longer than the actual balance regain time. You can tailor the balance delay to suit your character race/curing method/any other things that might influence the balance ... These routines would basicly be nothing more than glorified timers, but would save many people from scripting headaches. This is not limited to balances, but anything that induces (or that you want to induce) some kind of delay can be scripted this way. For example you could make a balance called "tempPlant", which would start running whenever you try to eat a plant, and would be reset automaticly after 0.4 seconds. This 'balance' could then be used to prevent spam-eating a plant, if due to any reason you haven't eaten the plant in 0.4 seconds, it will reset the tempPlant balance and try to eat again.

My apologies for using 'balance' instead of 'slot'. I'm just used to the term 'balance'.

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: The Mudlet Crucible

Post by Alexander Divine » Mon Jan 25, 2010 6:11 pm

What you mentioned is actually pretty great. I need to build balance timers into my system because these stupid goblins keep giving me blackout and my autobasher turns off. >.<

Caled
Posts: 399
Joined: Thu Apr 09, 2009 4:45 am

Re: The Mudlet Crucible

Post by Caled » Sun Feb 21, 2010 5:05 am

Ramiel wrote a rather nice balance system which I have been using. I forget if his forum name here is Ramiel or Leigh.

I'll post the code here for you, which is not exactly what you want but may give ideas. I've found it to be really solid, though I tweaked it slightly. It is not nearly dynamic enough to be what Crucible needs, but it is still solid and easy to work with. When I wrote a sytem for Lusternia, converting it to Lusternian balances was quite a simple process.


Balance System

Code: Select all

function balSpend(b)
	balance[b] = 0
end

function balBack(b)
	balance[b] = 1
	if affs.aeon ~= 1 then affs.newaffs = 1 end -- temporary fix for elm-looping (this was my tweak. It is only a hack-fix though)
end

function balReset()
	balance = {}
	balance.balance = 1
	balance.eq = 1
	balance.herb = 1
	balance.salve = 1
	balance.moss = 1
	balance.tree = 1
	balance.elixir = 1
	balance.health = 1
	balance.focus = 1
	balance.writhe = 1 -- another tweak of mine. See below for details.
	balance.renew = 1
end

-- The following function is one I myself don't use. I report balances on my prompt instead.
function balStats()
	fg("blue") bg("black")
	echo("----- ")
	fg("white") 
	echo(" Health: " .. balance.health .. "   Moss: " .. balance.moss .. "\n")
	fg("blue")
	echo("----- ")
	fg("white") 
	echo(" Herb: " .. balance.herb .. "   Salve: " .. balance.salve .. "   Tree: " .. balance.tree .. "   Focus: " .. balance.focus .. "   Elixir: " .. balance.elixir .. "\n")
	fg("blue")
	echo("----- ")
	fg("white") 
	echo(" Balance: " .. balance.balance .. "   EQ: " .. balance.eq .. "\n")
end
For the writhe balance, I tied my writhe curing into balance and expect system, to stop it from writhing multiple times. I did this because as I was writing the writhe system, it occurred to me that what I was doing was essentially the same as my balance system, and rather than reinventing the wheel, I called "You begin to writhe free of X" the "you have spent writhe balance" message, and the "you have writhed free of x" the "you have regained balance message.

I am mentioning that specifically to show how a decent, dynamic balance system can be useful for more than just the obvious purposes.

Expect System

Code: Select all

function doExpect(t, secs)
	expect[t] = 1
	local secs = (secs or 1)
	func = "expectCheck(\"" .. t .. "\")"
	tempTimer(secs, func)
end

function expectCheck(t)
	echo("<expectcheck " .. t .. ">\n")
	if expect[t] == 1 then 
		balBack(t)
		expect[t] = 0
		doCuresDbase()
	end
end

function expected(t)
	expect[t] = 0
end

function expectReset()
	expect = {}
	expect.herb = 1
	expect.salve = 1
	expect.moss = 1
	expect.tree = 1
	expect.elixir = 1
	expect.health = 1
	expect.focus = 1
	expect.aeon = 1 -- another of my tweaks, see below
	expect.writhe = 1
	expect.renew = 1
end
The expect system is what deals with things like stupidity or amnesia from causing sent commands to fail. This one uses a timer, which defaults to 1 second but can be different as you see.

The inclusion of aeon as an 'expect' (even though it is not a 'balance' in the balance system) is there to help with my aeon curing. I am specifically mentioning this because the code you're creating has uses other than just balance management, and it is good to keep this in mind.

Caled
Posts: 399
Joined: Thu Apr 09, 2009 4:45 am

Re: The Mudlet Crucible

Post by Caled » Sun Feb 21, 2010 5:29 am

Something else that occurred to me, which is important, is what you actually want to do once a balance is returned, or defaulted by the expect system. In the script I've posted, I rerun my curing function but that is a mud specific thing, and in fact not even ideal for my mud, since it is only using cure-related balances. If I wanted to integrate my action balances (arms, legs, eq etc) and my attack command queue, I would need to dive back into the code to do so.

Ideally, balBack() and expectCheck() would not do anything specific at all with any of the queues, but instead would just raise an event. (Incidentally, balBack() calls doCuresDbase() by way of flagging affs.newaffs=1, which is checked in my prompt trigger, while expectCheck() calls it directly. Either way, it is stuff that ought to be in event handler functions, rather than directly in the balance and expect system scripts.)

I apologise if the stuff I am saying is already what you're doing. I'm having trouble accessing launchpad from China so until I set up my vpn the best I can do is say what I think is important, and let you ignore it if I'm repeating what you already know :)

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: The Mudlet Crucible

Post by Heiko » Wed Mar 03, 2010 1:17 am

Bildschirmfoto-Mudlet 1.0.6.png
Bildschirmfoto-1.png

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest