Little help?

by Lanko

Back to Mechanic's Corner.

Lanko2006-06-18 05:30:26
Ok, I tried adding in a cure for sliced thighs. Thought I had done everything correclty-guess not. I keep getting a syntax error with this code:
#if @balance_herbs="yes"&@aff_anorexia=0&@aff_slit_throat=0 {#if @aff_slickness=1 {cal} {#if @aff_stupidity=1 {pen} {#if ((@aff_missing_ear_left=1)|(@aff_missing_ear_right=1)) {mar} {#if @aff_reckless=1 {hor} {#if @aff_weakness=1 {mar} {#if @aff_sensitivity=1 {myr} {#if @aff_dizziness=1 {kom} {#if @aff_haemophilia=1 {yar} {#if @aff_open_gut=1 {mar} {#if @aff_thin_blood=1 {yar} {#if @aff_clumsiness=1 {kom} {#if @aff_vestiphobia=1 {wor} {#if @aff_claustrophobia=1 {wor} {#if @aff_confused=1 {pen} {#if @aff_dementia=1 {pen} {#if @aff_hallucinations=1 {pen} {#if @aff_paranoia=1 {pen} {#if @aff_sliced_forehead=1 {yar} {#if ((@aff_severed_artery_larm=1)|(@aff_severed_artery_rarm=1)|(@aff_severed_artery_lleg=1)|(@aff_severed_artery_rleg=1)) {yar} {#if @aff_justice=1 {rei} {#if ((@aff_blindness=1)&(@def_sixthsense=0)) {fae} {#if ((@aff_deafness=1)&(@def_sixthsense=0)) {fae} {#if @aff_hypochondria=1 {wor} {#if @aff_epilepsy=1 {kom} {#if @aff_daydreams=1 {kaf} {#if @aff_punctured_aura=1 {cure_punctured_aura} {#if @aff_lovers_curse=1 {gal} {#if @aff_gluttoy=1 {gal} {#if @aff_pacified=1 {rei} {#if @aff_vapors=1 {kom} {#if @aff_agoraphobia=1 {wor} {#if @aff_addiction=1 {gal} {#if @aff_rigormortis=1 {mar} {#if @aff_generosity=1 {gal} {#if @aff_healthleech=1 {hor} {#if @aff_lethargy=1 {yar} {#if @aff_powersink=1 {rei} {#if @aff_open_chest=1 {mar} {#if @aff_vertigo {myr} {#if aff_sliced_biceps_left=1 {mar} {#if @aff_sliced_biceps_right=1 {mar} {#if @aff_punctured_chest=1 {mar} {#if @aff_sliced_thigh_right=1 {mar} {#if @aff_sliced_thigh_left=1 {mar}{}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} {}


if anyone can spot anything wrong, I would be very grateful. The syntax error seems to be a symptom of something of the sliced_thigh_left/right which is what I just tried to add into all the other stuff which was already there. The syntax error pointer (this little thing "^ syntax error) also seems to be finding a problem with -maybe- the last line of {}'s. any help is appreciated
Xavius2006-06-18 05:41:44
You'll want to doublecheck my count, but I believe you're short five }'s.
Lanko2006-06-18 15:10:14
how many should there be?
Soll2006-06-18 15:18:49
#if @balance_herbs="yes"&@aff_anorexia=0&@aff_slit_throat=0 {#if @aff_slickness=1 {cal} {#if @aff_stupidity=1 {pen} {#if ((@aff_missing_ear_left=1)|(@aff_missing_ear_right=1)) {mar} {#if @aff_reckless=1 {hor} {#if @aff_weakness=1 {mar} {#if @aff_sensitivity=1 {myr} {#if @aff_dizziness=1 {kom} {#if @aff_haemophilia=1 {yar} {#if @aff_open_gut=1 {mar} {#if @aff_thin_blood=1 {yar} {#if @aff_clumsiness=1 {kom} {#if @aff_vestiphobia=1 {wor} {#if @aff_claustrophobia=1 {wor} {#if @aff_confused=1 {pen} {#if @aff_dementia=1 {pen} {#if @aff_hallucinations=1 {pen} {#if @aff_paranoia=1 {pen} {#if @aff_sliced_forehead=1 {yar} {#if ((@aff_severed_artery_larm=1)|(@aff_severed_artery_rarm=1)|(@aff_severed_artery_lleg=1)|(@aff_severed_artery_rleg=1)) {yar} {#if @aff_justice=1 {rei} {#if ((@aff_blindness=1)&(@def_sixthsense=0)) {fae} {#if ((@aff_deafness=1)&(@def_sixthsense=0)) {fae} {#if @aff_hypochondria=1 {wor} {#if @aff_epilepsy=1 {kom} {#if @aff_daydreams=1 {kaf} {#if @aff_punctured_aura=1 {cure_punctured_aura} {#if @aff_lovers_curse=1 {gal} {#if @aff_gluttoy=1 {gal} {#if @aff_pacified=1 {rei} {#if @aff_vapors=1 {kom} {#if @aff_agoraphobia=1 {wor} {#if @aff_addiction=1 {gal} {#if @aff_rigormortis=1 {mar} {#if @aff_generosity=1 {gal} {#if @aff_healthleech=1 {hor} {#if @aff_lethargy=1 {yar} {#if @aff_powersink=1 {rei} {#if @aff_open_chest=1 {mar} {#if @aff_vertigo {myr} {#if aff_sliced_biceps_left=1 {mar} {#if @aff_sliced_biceps_right=1 {mar} {#if @aff_punctured_chest=1 {mar} {#if @aff_sliced_thigh_right=1 {mar} {#if @aff_sliced_thigh_left=1 {mar}{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} {}
Ashteru2006-06-18 15:56:39
Not to forget the @ at sliced_biceps_right. At vertigo you don't have the =1. And what's the | supposed to be? Otherwise, I don't see any other bugs...besides your priorities being a bit weird. tongue.gif
And are you using zMud? 'cause I don't think & and | work in zMud, it's and and or for it. (Which irks me to no end. ZMuds debugger sucks so much. -.-)
Soll2006-06-18 16:13:47
| is or.
Ashteru2006-06-18 16:26:30
Hm, so that DOES work in zMud? Interesting.
Lanko2006-06-18 21:13:52
QUOTE(Ashteru @ Jun 18 2006, 03:56 PM) 299574

Not to forget the @ at sliced_biceps_right. At vertigo you don't have the =1. And what's the | supposed to be? Otherwise, I don't see any other bugs...besides your priorities being a bit weird. tongue.gif
And are you using zMud? 'cause I don't think & and | work in zMud, it's and and or for it. (Which irks me to no end. ZMuds debugger sucks so much. -.-)



well, I'm not really good with coding so when you say my priorities, how do I change it? The ones first in the list have a higher priority I guess?
Verithrax2006-06-18 21:21:14
QUOTE(Lanko @ Jun 18 2006, 02:30 AM) 299497

Ok, I tried adding in a cure for sliced thighs. Thought I had done everything correclty-guess not. I keep getting a syntax error with this code:
#if @balance_herbs="yes"&@aff_anorexia=0&@aff_slit_throat=0 {#if @aff_slickness=1 {cal} {#if @aff_stupidity=1 {pen} {#if ((@aff_missing_ear_left=1)|(@aff_missing_ear_right=1)) {mar} {#if @aff_reckless=1 {hor} {#if @aff_weakness=1 {mar} {#if @aff_sensitivity=1 {myr} {#if @aff_dizziness=1 {kom} {#if @aff_haemophilia=1 {yar} {#if @aff_open_gut=1 {mar} {#if @aff_thin_blood=1 {yar} {#if @aff_clumsiness=1 {kom} {#if @aff_vestiphobia=1 {wor} {#if @aff_claustrophobia=1 {wor} {#if @aff_confused=1 {pen} {#if @aff_dementia=1 {pen} {#if @aff_hallucinations=1 {pen} {#if @aff_paranoia=1 {pen} {#if @aff_sliced_forehead=1 {yar} {#if ((@aff_severed_artery_larm=1)|(@aff_severed_artery_rarm=1)|(@aff_severed_artery_lleg=1)|(@aff_severed_artery_rleg=1)) {yar} {#if @aff_justice=1 {rei} {#if ((@aff_blindness=1)&(@def_sixthsense=0)) {fae} {#if ((@aff_deafness=1)&(@def_sixthsense=0)) {fae} {#if @aff_hypochondria=1 {wor} {#if @aff_epilepsy=1 {kom} {#if @aff_daydreams=1 {kaf} {#if @aff_punctured_aura=1 {cure_punctured_aura} {#if @aff_lovers_curse=1 {gal} {#if @aff_gluttoy=1 {gal} {#if @aff_pacified=1 {rei} {#if @aff_vapors=1 {kom} {#if @aff_agoraphobia=1 {wor} {#if @aff_addiction=1 {gal} {#if @aff_rigormortis=1 {mar} {#if @aff_generosity=1 {gal} {#if @aff_healthleech=1 {hor} {#if @aff_lethargy=1 {yar} {#if @aff_powersink=1 {rei} {#if @aff_open_chest=1 {mar} {#if @aff_vertigo {myr} {#if aff_sliced_biceps_left=1 {mar} {#if @aff_sliced_biceps_right=1 {mar} {#if @aff_punctured_chest=1 {mar} {#if @aff_sliced_thigh_right=1 {mar} {#if @aff_sliced_thigh_left=1 {mar}{}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} {}
if anyone can spot anything wrong, I would be very grateful. The syntax error seems to be a symptom of something of the sliced_thigh_left/right which is what I just tried to add into all the other stuff which was already there. The syntax error pointer (this little thing "^ syntax error) also seems to be finding a problem with -maybe- the last line of {}'s. any help is appreciated

And they say Lisp has too many parenthesis, just look at this!

Seriously though, I have no idea of how to parse ZMud script. I'm just bored. Although ZMud should indent that stuff for you.
Soll2006-06-18 21:22:49
It indents if there is more than one command in the parenthesis.
Unknown2006-06-18 21:23:16
thats the worst thing about zmud - if you have an #IF with a single statement inside the {} then it will keep it on one line. Unfortunately, #IF counts as a single statement... so you get
#IF () {#IF () {#IF () {} } } etc
Soll2006-06-18 21:24:40
.
Ashteru2006-06-18 21:37:47
I'd put Anorexia first, then stupidty, then reckless, and then, hmm...well, depends how you like it. It's basically the sooner the affliction comes in your program, the faster it's cured. So if you have recklessness and stupidty, it will first cure stupidity and then go through the check again, then curing recklessness.
Soll2006-06-18 21:49:34
dunno.gif That's just how I prefer it, really. I despise stupidity. tongue.gif And anyway, if I have stupidity I focus mind as well, so that shrugs Anorexia. smile.gif
Unknown2006-06-18 22:26:09
OMG, my brain is dribbling out my ears, just by looking at that! Thank GOD Nexus doesn't use that!
Unknown2006-06-18 22:29:55
I reallly hate nested IF's soly for the fact that they're tedious to figure out and recode.

Have you ever considered doing a overwriting list type of system, Lanko?

#if {@A="t" & @B="t" & @C="&t"} {
#if @slickness="t" {herb=sli}
#if @stupidity="t" {herb=stu}
}
#if {@sleep="f" & @etc="f"} {@herb}
herb=""

It's a lot easier to organize, and cleaner on the eyes and mind, in my opinion.
Murphy2006-06-19 02:10:01
Yeh i find that coding to be way too messy andhard to debug

I much prefer going #IF (@herbbalance = 1 AND @stunned = 0) {do thing here} it's neater and easier to follow
Laysus2006-06-21 22:38:09
I've gone away from using nested ifs, other than basic queues (root balance/herb queues), gone to using lists and pulling the first curable item out of them.
Unknown2006-06-22 02:17:00
I love my data record variables and string lists. I need to re-code my Lusternia stuff to use less of the #IF and take more advantage of the records and lists, like my Achaean code does. It's very flexible, and actually faster, I think.

For example (pulled from my Achaea system and modified for a -little- bit more simplicity):
CODE
#ALIAS i_herb  {#priority {herb_priority = 100;#loopdb @afflictions {#if (!%iskey(@scanned_affs, %key)) {herb_pos = %ismember(%key, @herb_affs);#if (@herb_pos > 0 and @herb_pos < @herb_priority) {herb_priority = @herb_pos}}};#if (@herb_priority < 100) {i_add scanned_affs %item(@herb_affs, @herb_priority) herb;i_eat %db(@herb_cures, %item(@herb_affs, @herb_priority))}}}
Sylphas2006-06-22 03:23:02
This reminds me why I'm so happy to be coding my system in Python.