Anti Illusion system. Too complex?

Post Reply
Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Anti Illusion system. Too complex?

Post by Skriptz »

Okay I have been trying this for a long while with little success. I am trying to make a curing system with several functions to make it change easier.

First I check if I am afflicted by doing a diagnose using an alias "diag"
Code: [show] | [select all] lua
	Check.Diag = 1
send("diag")	
ResetAff()
	
		tempTimer( 2, [[ if Check.Diag == 1 then Check.Diag = 0 end ]] )
The above makes check diag true so the system knows it was me that did it and not a illusion. ResetAff is to make all the afflictions = 0

First will trigger on the diagnose.
You are:
allergic to sunlight.
afflicted with clumsiness.
an insomniac.
H:2705 M:3436 E:99% W:100% XP:20% [-b]
Code: [show] | [select all] lua
if 	Check.Diag == 1 
then 
	Aff.Clumsiness = 1 
	tempLineTrigger(1,1,[[if isPrompt() then Check.Diag = 0 end]])
else
	echo("\nPossible Illusion - Ignoring\n")
end
The above is to check if I did indeed do a diagnose and changes Aff.Clumsiness to 1 which it does.

Now on prompt I run a HerbCuring function
Code: [show] | [select all] lua
function HerbCuring()

if Dead == 0 and Aff.Anorexia == 0 and Aff.Aeon == 0 and Aff.Stunned == 0 and 
Aff.Sleep == 0 and Balance.Herb == 1
	then if 

		Aff.Paralysis == 1 then send("outc bloodroot;eat bloodroot")
			EatHerb()

	elseif

		Aff.Stupidity == 1 then send("outc goldenseal;eat goldenseal;outc goldenseal;eat goldenseal;outc goldenseal;eat goldenseal")
			EatHerb()

	elseif

		Aff.Clumsiness == 1 then send("outc kelp;eat kelp")
			EatHerb()
That just says if I'm all above then cure it. It doesn't.

EatHerb function is as so
Code: [show] | [select all] lua
function EatHerb()

			Balance.Herb = 0.5
			Check.EatHerb = 1
		tempTimer( 1, [[ if Check.EatHerb == 1 then Check.EatHerb = 0 end ]] )
		tempTimer( 3, [[ if Balance.Herb == 0.5 then Balance.Herb = 1 end ]] )

end
Now this changes my herb balance to 0.5 and changes it back when it says I have regained balance. tempTimer is there just incase something goes wrong.
Check.EatHerb is to make sure that I have indeed have eaten a herb.

I've been on this all day yesterday and half today. I got it working once but then it just stopped yet I'm sure I haven't done anything different.

Can anyone help me?

I also have done a quick video so you can hopefully see the problem. http://screencast.com/t/YTY0ZDI1NDE

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: Anti Illusion system. Too complex?

Post by Skriptz »

What is wrong with this code? I tried to make it simple and it still doesn't work. I cut out the EatHerb function it doesn't work. I get rid of the starting variables and it still doesn't work. I remove all the if statements and still doesn't work. I tried using only a echo function in the function and that does work.
Code: [show] | [select all] lua
-- Curing Function
-- Herb Cures

function HerbCuring()
if Dead == 0 and Aff.Anorexia == 0 and Aff.Aeon == 0 and Aff.Stunned == 0 and 
Aff.Sleep == 0 and Balance.Herb == 1
	then if 

		Aff.Paralysis == 1 then send("outc bloodroot;eat bloodroot")
			EatHerb()

	elseif

		Aff.Stupidity == 1 then send("outc goldenseal;eat goldenseal;outc goldenseal;eat goldenseal;outc goldenseal;eat goldenseal")
			EatHerb()

	elseif

		Aff.Dementia == 1 then send("outc ash;eat ash")
			EatHerb()

	elseif

		Aff.Sensitivity == 1 then send("outc kelp;eat kelp")
			EatHerb()

	elseif

		Aff.Recklessness == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Pacifism == 1 then send("outc bellwort;eat bellwort")
			EatHerb()

	elseif

		Aff.Slickness == 1 then send("outc bloodroot;eat bloodroot")
			EatHerb()

	elseif

		Aff.Peace == 1 then send("outc bellwort;eat bellwort")
			EatHerb()

	elseif

		Aff.Masochism == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Berserk == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Claustrophobia == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Agoraphobia == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Fear_of_commitment == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Addiction == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

	elseif

		Aff.Asthma == 1 then send("outc kelp;eat kelp")
			EatHerb()

	elseif

		Aff.Clumsiness == 1 then send("outc kelp;eat kelp")
			EatHerb()

	elseif

		Aff.Limp_veins == 1 then send("outc kelp;eat kelp")
			EatHerb()

	elseif

		Aff.Paranoia == 1 then send("outc ash;eat ash")
			EatHerb()

	elseif

		Aff.Hallucinations == 1 then send("outc ash;eat ash")
			EatHerb()

	elseif

		Aff.Confusion == 1 then send("outc ash;eat ash")
			EatHerb()

	elseif

		Aff.Shyness == 1 then send("outc goldenseal;eat goldenseal")
			EatHerb()		

	elseif

		Aff.Epilepsy == 1 then send("outc goldenseal;eat goldenseal")
			EatHerb()

	elseif

		Aff.Self_pity == 1 then send("outc goldenseal;eat goldenseal")
			EatHerb()

	elseif

		Aff.Body_odor == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

	elseif

		Aff.Haemophilia == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

	elseif

		Aff.Dizziness == 1 then send("outc goldenseal;eat goldenseal")
			EatHerb()	

	elseif

		Aff.Loneliness == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Vomiting == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

	elseif

		Aff.Earthrot == 1 then send("outc bloodroot;eat bloodroot")
			EatHerb()

	elseif

		Aff.Vertigo == 1 then send("outc lobelia;eat lobelia")
			EatHerb()

	elseif

		Aff.Sadness == 1 then send("outc ash;eat ash")
			EatHerb()

	elseif

		Aff.Pride == 1 then send("outc bellwort;eat bellwort")
			EatHerb()

	elseif

		Aff.Heartflutter == 1 then send("outc bloodroot;eat bloodroot")
			EatHerb()

	elseif

		Aff.Sunlight_allergy == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

	elseif

		Aff.Lethargy == 1 then send("outc ginseng;eat ginseng")
			EatHerb()

end
end
end

Knute
Posts: 87
Joined: Fri Mar 05, 2010 12:08 am

Re: Anti Illusion system. Too complex?

Post by Knute »

I guess that the first thing that I noticed was the outc.... I'm used to lusternia which is outr....

Assuming that all the commands are correct, you might want to change your send(command;command) to sendAll("command", "command")
Otherwise, I don't see where your issue is.

Skriptz
Posts: 45
Joined: Sun Dec 27, 2009 10:48 pm

Re: Anti Illusion system. Too complex?

Post by Skriptz »

Knute wrote:I guess that the first thing that I noticed was the outc.... I'm used to lusternia which is outr....

Assuming that all the commands are correct, you might want to change your send(command;command) to sendAll("command", "command")
Otherwise, I don't see where your issue is.
I was really hoping it would be something as simple as that but no, it still doesn't work.


EDIT: I finally found the problem. The dead variable brings back nil value so it destroyed everything. I am so happy now :D

Post Reply