KoLMafia Scripting Contest: Repair the Elves' Shield Generator

slyz

Developer
I will soon post in the KoL Contest forum a new scripting contest. The goal is to give people who know little or nothing about ASH some incentive to write a script that will complete the new Repair the Elves' Shield Generator quest.

This thread is where they will be directed to ask for advice.

I would like to ask a couple of things to the more veteran scripters here:
  • Please do not post a script of your own that completes the quest. Of course, if someone does post such a script, I will simply try to see if contestants are using all or part of it and their submissions will be turned down.
  • If someone contacts you for some help, please ask them to post their questions here, so everyone can benefit from your reply.
  • Feel free to give as much help as possible about ASH in general, but as little help as possible about the object of the contest.
 
Oh, this is cool, as I started working on this today. I have a plan now, I was going to try to code and test it over the next couple days.
 
Update: I have parts that are working. I have parts that are working but could and need to work better. I have parts that aren't working at all yet. :O

The most infuriating part atm is the part that's not working yet. I'm having a hell of a time stepping thru the chained choice adventures to get the e.m.u. parts. However, and here's the part that's infuriating, I have a pill farming script for Deep Inside Grimace that works, using the exact same technique.

My head is starting to hurt from all the desking.
 
Last edited:

fronobulax

Developer
Staff member
But if you mean things like

enum colors = {red, yellow, blue}

for each x in colors

and so forth then I'd say no, although you might get similar functionality from maps.
 

stannius

Member
I suppose one could do something similar with a "record" data structure. Although that would not allow enumeration through the values.

It's just a coding style thing anyways. I usually use enum's to avoid magic numbers.
 

Veracity

Developer
Staff member
You can avoid magic numbers by doing

int RED = 1;
int BLUE = 2;

and so on, although you don't get the other advantages of enumerations by doing so.
 
I'm working on how to keep Transpondent running. I have two ideas:

1) Check have_effect() every time I do something.
2) Set it up as a mood.

#1 would do exactly what I want but seems lame/inelegant.
#2 seems to work for me. What I do is save the old mood, create a new one, add Transpondent to the new mood, do my script, then switch back to the original mood. This leaves my temporary mood around though (which I don't like).

Is there a command to delete a mood? "triggers clear" makes the mood blank, but how do I actually delete it?
Would it be okay (script etiquette wise) to just wipe their current mood, add what I need, do script and wipe it again?

Also, slyz, I am not sure how much you want us to fend for ourselves. If you'd rather me not ask questions like this, please let me know.
 

Winterbay

Active member
I don't think you can actually delete a mood via a script. I know more than one script that just deletes the content of the active mood and makes whatever they want with it. Optimally you would be able to both add and remove a certain trigger via a command but unfortunately I think you can only add things or wipe the entire thing.
If you care about preserving the users settings I would recommend creating a mood and leave it behind. Perhaps with a message saying that they can now delete it if they don't want it any more.
 

lostcalpolydude

Developer
Staff member
They might be relying on a mood for killing scaling monsters, so I don't think overwriting it is really an option for a working script.
 

slyz

Developer
Also, slyz, I am not sure how much you want us to fend for ourselves. If you'd rather me not ask questions like this, please let me know.
I think this thread should be for technical questions about ASH itself: "why am I get that error", or "is there a function to see if an effect is running". You should work out how you want to keep the transpondent effect running by yourself.

Lost does make a good point though, for contestants who decide to let the user setup mafia for fights themselves.
 

heeheehee

Developer
Staff member
You can avoid magic numbers by doing

int RED = 1;
int BLUE = 2;

and so on, although you don't get the other advantages of enumerations by doing so.

I suppose you could at least have some way to iterate over them, but this is a bit hacky in itself. :p
Code:
record Color {
  string name;
};
Color RED = new Color("red");
Color BLUE = new Color("blue");
int [Color] COLORS;
COLORS[RED] = 1;
COLORS[BLUE] = 2;
 

FractalP

New member
Hey guys, loving this contest idea, running into a bit of an issue when working on my script though. Well, it's not exactly an issue, just a question I had.

Say for example I want to have an array of ints pre-filled with some values, like so:
Code:
int [int] foo;
foo[0] = 1;
foo[1] = 2;
foo[2] = 3;

That's fine for when I only have a handful of data, but when I'm using 20+ values in there it starts to get a bit unsightly at the beginning of the script. So I tried the usual syntax to initialize it with a list of values:

Code:
int [int] foo = {1,2,3};

but to no avail. I've fiddled around with this a bunch, and scoured the wiki, but have had no success. Is there any shortcut to avoid having a large bunch of assignments at the beginning of my script?
 

Winterbay

Active member
You could use a for-loop to set the variable if there is a logical link between them, would be hard if the variables are not logically linked though. A list of declarations is possibly the best solution.

So in your example:
Code:
int[int] foo
for i from 1 to 3
   foo[i] = i;
 

heeheehee

Developer
Staff member
Alternatively, you can attempt the datafile-based approach: either build your datafile manually or generate it with unsightly copy-pasting (and slight modifications), then just load it subsequent times. Zarqon's map manager may be useful here for extra wow-factor (or, y'know, an additional point of failure if his site goes offline :D).
 
Top