CounterHack / HolidayHack2020

SANS Holiday Hack Challenge 2020
13 stars 1 forks source link

elfcode: elf.ask_munch(0) brings back undefined on level 7 #8

Closed DigitalSkateboarder closed 3 years ago

DigitalSkateboarder commented 3 years ago

As the subject says, elf.ask_munch(0) brings back undefined on level 7

chrisjd20 commented 3 years ago

the elf.ask_munch is never called for on Level 7. Read the task more closely. He's asking you to simply submit a function that performs the task and returning the value its looking for. For example:

// elf.ask_munch(0) is never used
elf.tell_munch(function(MUNCHSPASSEDOBJECT) {
 // DO WHATEVER THE MUNCHKIN IS ASKING YOU TO DO
 // to MUNCHSPASSEDOBJECT
 return SOMEVALUEFROMMUNCHSPASSEDOBJECT
})
chrisjd20 commented 3 years ago

You could also abstract the function out and simply pass the function name. That should be whats in the example when you click on the munchkin for levels 7 and 8.

function ParseMunchData(MUNCH_PASSED_OBJ) {
 // do the required task to MUNCH_PASSED_OBJ
 return desired_value_from_MUNCH_PASSED_OBJ
}
// elf.ask_munch(0) is never used
elf.tell_munch(ParseMunchData)
chrisjd20 commented 3 years ago

In fact, if you click on the munchkin in the CURRENT LEVEL OBJECTS window, you'll see a similar example:

image

DigitalSkateboarder commented 3 years ago

Hey, really appreciate you getting back so quick! Thank you.

Must be missing something - I did exactly as mentioned but it wasn't working. Did something in jsFiddle passing through that example array of arrays and it worked.