Casting Invis with low Contamination


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

Temple Termagant

Posts: 10

Joined: Saturday, 14th December 2013, 03:53

Post Wednesday, 19th March 2014, 02:28

Casting Invis with low Contamination

Not sure in which subforum should this go, so putting it here.

Can somebody share a script for the init file that does the following (if it is possible, at all):

When I try to cast Invisibility, and I have low magic contamination, the game should give me an "Are you sure?" prompt.

I usually am careful but just got a (mild) bad mutation cause I accidentally forgot to sleep the contamination off :s and don't want it to happen again.

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Wednesday, 19th March 2014, 03:18

Re: Casting Invis with low Contamination

Yes, I am really interested in it too. Unfortunately my patch for this functionality is ignored on mantis.
User avatar

Ziggurat Zagger

Posts: 5832

Joined: Thursday, 10th February 2011, 18:30

Post Wednesday, 19th March 2014, 04:54

Re: Casting Invis with low Contamination

I think glow from invisibility and haste should appear *after* the effect is over.
"Be aware that a lot of people on this forum, such as mageykun and XuaXua, have a habit of making things up." - minmay a.k.a. duvessa
Did I make a lame complaint? Check for Bingo!
Totally gracious CSDC Season 2 Division 4 Champeen!

Halls Hopper

Posts: 81

Joined: Monday, 10th January 2011, 00:50

Post Wednesday, 19th March 2014, 04:57

Re: Casting Invis with low Contamination

XuaXua wrote:I think glow from invisibility and haste should appear *after* the effect is over.


I'm confused, what's your reasoning for this? Feel like I missed something.
KoboldLord wrote: Equipment that you don't have isn't going to improve your survivability any.
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Wednesday, 19th March 2014, 05:34

Re: Casting Invis with low Contamination

There's a function in l_you.cc that tells you your contaim level (contaminatedl() if I'm reading the code correctly.) The problem is getting the prompt to work whenever you cast those spells, and I'm going to guess there's no way to do that because crawl code isn't designed to support Lua macros to that degree. You could do some macro magic to get around this, though. (I'd probably set it up so Invisibility and Haste are automatically assigned to Capital Letters, and then you can access them through a lua macro. Then connect the lua macro to a key in game on a per game basis and you're good to go.)

Kaeoschassis wrote:
XuaXua wrote:I think glow from invisibility and haste should appear *after* the effect is over.


I'm confused, what's your reasoning for this? Feel like I missed something.
Ignore XuaXua, nobody else understands him either.
On IRC my nick is reaverb. I play online under the name reaver, though.

Abyss Ambulator

Posts: 1205

Joined: Friday, 8th November 2013, 17:02

Post Wednesday, 19th March 2014, 14:29

Re: Casting Invis with low Contamination

Even better would be a prompt whenever an action would take you to yellow contamination. If I haste, fight, rest a little, then want to haste again, I have no idea if another haste is going to put me into yellow contam or not. Even worse with invis, where contamination just builds while you're under the effect. It'd be nice if invis just ended right before it took you to that level of contamination, since the game doesn't give me adequate info to know whether or not it's safe.

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Wednesday, 19th March 2014, 15:14

Re: Casting Invis with low Contamination

If you want to be safe, cast Invisibility OR Haste only when you have no contamination. It's impossible to get yellow contamination by a single cast of those spells.
User avatar

Vestibule Violator

Posts: 1509

Joined: Wednesday, 21st September 2011, 01:10

Location: St. John's, NL, Canada

Post Wednesday, 19th March 2014, 15:20

Re: Casting Invis with low Contamination

reaver wrote:Then connect the lua macro to a key in game on a per game basis and you're good to go.

crawl will remember your macros between games if you save them (in game with ~s or prompted on save/death), so if the function is defined as safeinvis in your rcfile you can macro F1 to "===safeinvis" and you're set.
Won all race/bg, unwon (online): Nem* Hep Uka
Favourites: 15-rune Trog, OgNe/OgIE/OgSu (usually Ash), Ds, Ru, SpEn, Ce of Chei, Qaz

Abyss Ambulator

Posts: 1205

Joined: Friday, 8th November 2013, 17:02

Post Wednesday, 19th March 2014, 16:45

Re: Casting Invis with low Contamination

Sandman25 wrote:If you want to be safe, cast Invisibility OR Haste only when you have no contamination. It's impossible to get yellow contamination by a single cast of those spells.

I understand that. But if I really wanted to, I could keep track myself of the turns that have passed since I contaminated myself, to know when it's safe, even though I still have "contam" status. So it'd be nice to either give better granularity of the contam status, or just prompt when I'm about to do something that gives me yellow contam. Otherwise optimal play would be to keep a notepad and write the turn count whenever I cast haste or invisibility, or cblink, so I know if I'm in "deep grey" or "light grey".

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Wednesday, 19th March 2014, 16:48

Re: Casting Invis with low Contamination

It will never happen. For similar reason you never know how long Death's Door will last.

zrn

User avatar

Snake Sneak

Posts: 112

Joined: Friday, 25th February 2011, 01:38

Post Wednesday, 19th March 2014, 17:04

Re: Casting Invis with low Contamination

damiac wrote:But if I really wanted to, I could keep track myself of the turns that have passed since I contaminated myself, to know when it's safe, even though I still have "contam" status.

Contam fading away doesn't work like that. I'm not sure of the code behind it, but it's random how long it takes to fade away, so the most severe grey contam can fade away quickly or stick around for a while. Same for the way it's gained, so you can't really say 'I had invis on for 30 turns, therefore I have X levels of contamination.' If a script could determine when it would be safe to cast invis/haste at your current power, then that would give away more information than is intended, I think.

Abyss Ambulator

Posts: 1205

Joined: Friday, 8th November 2013, 17:02

Post Wednesday, 19th March 2014, 17:16

Re: Casting Invis with low Contamination

Ah, well I didn't know that. So in that case, I guess the game can't tell you, you just have to gamble on getting a bad mutation occasionally, and most of the time, just 5 it away.
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Wednesday, 19th March 2014, 22:23

Re: Casting Invis with low Contamination

rchandra wrote:
reaver wrote:Then connect the lua macro to a key in game on a per game basis and you're good to go.

crawl will remember your macros between games if you save them (in game with ~s or prompted on save/death), so if the function is defined as safeinvis in your rcfile you can macro F1 to "===safeinvis" and you're set.
Yeah, but what key would you have always macroed to Invis? I don't know any way of having a multiple key macro (i.e, press "z" and then "a" to activate a maco that checks). Thanks for the -s option though, I didn't know about that.
On IRC my nick is reaverb. I play online under the name reaver, though.

Vaults Vanquisher

Posts: 508

Joined: Tuesday, 1st November 2011, 00:36

Post Thursday, 20th March 2014, 00:24

Re: Casting Invis with low Contamination

It would still make sense to give you a warning when you try to cast haste/invis at non-zero contamination.
User avatar

Ziggurat Zagger

Posts: 4478

Joined: Wednesday, 23rd October 2013, 07:56

Post Thursday, 20th March 2014, 11:29

Re: Casting Invis with low Contamination

With invisibility, it's not just the risk of getting a bad mutation. If you're glowing, you're not invisible.
DCSS: 97:...MfCj}SpNeBaEEGrFE{HaAKTrCK}DsFESpHu{FoArNaBe}
FeEE{HOIEMiAE}GrGlHuWrGnWrNaAKBaFi{MiDeMfDe}{DrAKTrAMGhEnGnWz}
{PaBeDjFi}OgAKPaCAGnCjOgCKMfAEAtCKSpCjDEEE{HOSu
Bloat: 17: RaRoPrPh{GuStGnCa}{ArEtZoNb}KiPaAnDrBXDBQOApDaMeAGBiOCNKAsFnFlUs{RoBoNeWi

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Thursday, 20th March 2014, 12:02

Re: Casting Invis with low Contamination

Yes, this is why I created that patch. https://crawl.develz.org/mantis/view.php?id=8203
I don't understand why it is ignored. It does not change anything unless player modifies RC file explicitly and it is completely and carefully tested.
User avatar

Vestibule Violator

Posts: 1509

Joined: Wednesday, 21st September 2011, 01:10

Location: St. John's, NL, Canada

Post Friday, 21st March 2014, 03:17

Re: Casting Invis with low Contamination

reaver wrote:Yeah, but what key would you have always macroed to Invis? I don't know any way of having a multiple key macro (i.e, press "z" and then "a" to activate a maco that checks). Thanks for the -s option though, I didn't know about that.

Here you go:
  Code:
spell_slot += Invisibility : V

{
function safeinvis()
  if you.contaminated() == 0  then
    crawl.sendkeys("zV.")
  else
    crawl.mpr("You are contaminated; press zV to cast anyway.")
  end
end
}


A quick test has this working. You might want to use a force_more on the printed message, or change it to fit an existing force_more.
Won all race/bg, unwon (online): Nem* Hep Uka
Favourites: 15-rune Trog, OgNe/OgIE/OgSu (usually Ash), Ds, Ru, SpEn, Ce of Chei, Qaz

For this message the author rchandra has received thanks:
Sandman25
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Friday, 21st March 2014, 21:04

Re: Casting Invis with low Contamination

Oh, looks like my macro development has been ninja'd by rchandra.

One last note, you can put a prompt in a lua macro, like this:

  Code:
spell_slot += Invisibility : V

{
function safeinvis()
  if you.contaminated() == 0  then
    crawl.sendkeys("zV.")
  else
    if crawl.yesnoquit("You are contaminated. Cast anyway?", true, false, false, false) then
        crawl.sendkeys("zV.")
    end
  end
end
}


Which will prompt you if you are contaminated, letting you press "y" to cast invisibility.
On IRC my nick is reaverb. I play online under the name reaver, though.

For this message the author reaver has received thanks:
Sandman25

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Saturday, 22nd March 2014, 16:21

Re: Casting Invis with low Contamination

This version works for me.

  Code:
spell_slot += Invisibility : O

{
function safeinvis()
  if you.contaminated() == 0  then
    crawl.sendkeys("zO.")
  else
    if crawl.yesnoquit("You are contaminated. Cast anyway?", true, 'n') == 1 then
        crawl.sendkeys("zO.")
   else
     crawl.mpr("Ok, then")
   end
  end
end
}

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: No registered users and 101 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.