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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  String Manipulation

String Manipulation

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1  2  3  4 

Posted by Kevnuke   USA  (145 posts)  [Biography] bio
Date Reply #45 on Mon 16 Apr 2012 12:31 AM (UTC)
Message
Yea it didn't work..the aliases i'm making aren't provoking a response from the server. What's wrong with them?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #46 on Mon 16 Apr 2012 07:26 AM (UTC)
Message

function ProvokeInventory()

	SendPkt("\255\250\201Char.Items.Inv\255\240")

end


That just defines a function. It doesn't execute it.

- Nick Gammon

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

Posted by Kevnuke   USA  (145 posts)  [Biography] bio
Date Reply #47 on Mon 16 Apr 2012 11:54 PM (UTC)
Message
Wow I can't believe I didn't catch that. Rookie mistake. Thanks Nick
[Go to top] top

Posted by Kevnuke   USA  (145 posts)  [Biography] bio
Date Reply #48 on Tue 17 Apr 2012 01:12 AM (UTC)
Message
Sooo I have a brand new problem. I'm trying to integrate the new curing items from achaea into my curing system without completely rewriting it. First, here's the code:


herbaff		=	{

	"addiction",
	"agoraphobia",
	"asthma",
	"blind",
	"claustrophobia"

}

herbcure	=	{

	addiction		=	GinsengFerrumChoice() or "ginseng",
	agoraphobia		=	LobeliaArgentumChoice() or "lobelia",
	asthma			=	KelpAurumChoice() or "kelp",
	blind			=	BayberryArsenicChoice() or "bayberry",
	claustrophobia		=	LobeliaArgentumChoice() or "lobelia",

}

function GinsengFerrumChoice ()

	if outr.ginseng > 0 then

		return "ginseng"

	end

	if outr.ferrum > 0 then

		return "ferrum"

	end

	if inr.ginseng > 0 then

		return "ginseng"

	end

	if inr.ferrum > 0 then

		return "ferrum"

	end
	
end

function CureHerb ()

	for k, v in ipairs (herbaff) do

		if aff[v] then

			_G["herb"] = herbcure[v]

			if not (herb == "hawthorn") then

				if (tonumber(outr[herb]) > 0) then

					if EatGo() then

						HerbEat()
						Send ("eat " .. herbcure[v])

					return

					end

				elseif (tonumber(inr[herb]) > 0) then

					if OutrGo() then

						HerbOutr()
						Send ("outr " .. herbcure[v])

					return

					end

				end

			elseif balance.hawthorn then

				if (outr.hawthorn > 0) then

					if EatGo() then

						HerbEat()
						Send ("eat hawthorn")

					return

					end

				elseif (inr.hawthorn > 0) then

					if OutrGo() then

						HerbOutr()
						Send ("outr hawthorn")

					return

					end

				end

			return

			end

		end

	end

end



They pretty much made it so each affliction has two items that can cure it. My systems fine if I want to ONLY use the existing curing items, but i wanted to make it so that my curing system automatically uses the secondary item for each cure if I run out of the primary curing item. outr.<cure> refers to items that are in my inventory (and thus ready to be eaten) inr.<cure> refers to a cure that I have more of but are still in my rift.

In the case of the example function I showed, it would first check to see if I have ginseng in my inventory, then ferrum. If neither is in my inventory, it checks to see if either one is in my rift, checking ginseng first, then ferrum.
[Go to top] top

Posted by Kevnuke   USA  (145 posts)  [Biography] bio
Date Reply #49 on Wed 18 Apr 2012 12:44 AM (UTC)
Message
Actually, I had an epiphany. I think I'm just going to scrap that idea and recode it to work around the two choices each being an index in the table for each affliction. Like so:


herbcure  =  {

  addiction		=	{"ginseng", "ferrum"},
  agoraphobia		=	{"lobelia", "argentum"},
  asthma		=	{"kelp", "aurum"},
  blind			=	{"bayberry", "arsenic"},
  claustrophobia	=	{"lobelia", "argentum"},

}

And then I'll modify the CureHerb function to make it work.
[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.


98,104 views.

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

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]