#(behr) alternative script

1 messages · Page 1 of 1 (latest)

crisp island
#

my script:

starter_random_foods:
  type: procedure
  definitions: foods|quantity
  script:
    - define food_base <inventory[generic[inventory_contents=<list>]]>
    - define food_list <list>
    - foreach <[foods]> as:food:
      - define food_list <[food_list].include_single[<[food].repeat_as_list[<[quantity]>]>]>
    - give <[food_list].random[<[quantity]>].parse[as[item]]> to:<[food_base]>
    - determine <[food_base].list_contents>```

can't work because give can't be used in a proc; is there a tag that concatenates the items in a list when giving it to an inventory?
what i want is nine random total items of three types randomly, but not nine stacks of those items as opposed to however many stacks they could be minimally, eg 8 tacos and 1 lasagna

woeful arrowBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

stiff cove
#

I'm really struggling to follow what this is doing o-0

#

It creates an empty list and then fills it with a list which is the first input an amount of times equal to the quantity

chrome smelt
#

<inventory[generic[inventory_contents=<proc[starter_random_foods>]>]>

#

put the inventory outside of the proc

#

and use the proc to generate the list of items

#

define food_list <[food_list].include_single[<[food].repeat_as_list[<[quantity]>]>]>

#

No idea why you would use repeat_as_list times the quantity when you could do

crisp island
#
starter_kit:
  type: item
  debug: false
  material: bundle
  mechanisms:
    inventory_contents`````````````````````````````````````:
      - <list[golden_gyro|sweet_gyro|spicy_gyro].random>
      - <list[golden_gyro|sweet_gyro|spicy_gyro].random>
      - <list[golden_gyro|sweet_gyro|spicy_gyro].random>
      - phantom_membrane[quantity=20]
      - firework_rocket[quantity=64]
      - <list[gyro|hamburger|sandwich|hotdog].proc[starter_random_foods].context[9]>```
chrome smelt
#

!paste

blissful tinselBOT
crisp island
#

aaa

chrome smelt
#

^

crisp island
chrome smelt
#

behr

#

is this solved kekwcry

crisp island
#

no lol my xy i made caused you to give me an answer to how i should do it outside of a proc, im ujsing a proc because im not actually making an inventory script at all, i did it to pseudo organize the list

#

im putting the proc inside an itemtag's inventory_contents mechanism

#

(i should have said that first)

chrome smelt
#

Yeah uh still

#

make it determine a list ?

#

if you want air in between you can randomly add air

#

!t list.pad_right.with

blissful tinselBOT
chrome smelt
#

!t list.random

crisp island
#

i want them to stack if they repeat, like trying to make a proc that takes taco|burrito and 3 return taco[quantity=X]|burrito[quantity=Y], where X+Y=3

blissful tinselBOT
# chrome smelt !t list.random

Gets a random item in the list and returns it.
Optionally, add [<#>] to instead get a list of multiple randomly chosen list entries.

Returns

ObjectTag

Examples
# Narrates EITHER "one" OR "two" - different each time!
- narrate "<list[one|two].random>
# Could narrate "one|two", "two|three", OR "one|three" - different each time!
- narrate "<list[one|two|three].random[2]>
# Could narrate "one|two|three", "one|three|two", "two|one|three", "two|three|one", "three|two|one", OR "three|one|two" - different each time!
- narrate "<list[one|two|three].random[9999]>
crisp island
#

i want taco[quantity=3]|burrito and not taco|taco|taco|burrito

chrome smelt
#

I'm sorry I can't see the issue

crisp island
#

this should be one stack

chrome smelt
#

!debug

blissful tinselBOT
# chrome smelt !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

crisp island
#

/ex give bundle[inventory_contents=<item[gyro].repeat_as_list[64]>]

#

i dont know how to write what i want is my issue

chrome smelt
#

inventory_contents=gyro[quantity=64]>

crisp island
#

what if i want, amongst 64, two items randomly that equial 64?

chrome smelt
#

wat

crisp island
#

of 64 items, i want randomly gyros and hamburgers

#

a random number of both that equal 64 lol

chrome smelt
#

math it out?

#

and then add the quantity

crisp island
#

im looking for a tag that does that kekw_dog

chrome smelt
#
- define quantity_gyro <util.random.int[1].to[64]>
- define quantity_burgers <element[64].sub[<[quantity_gyro]>]>
#

I mean this is pretty simple, I assume you have more items?

crisp island
#

i have four right now but would like to use a proc for other kit type bundles for other things yeah, but um

chrome smelt
#

If this is the case, you could just repeat 64 and set some chances and define X Y Z , which are the amounts of specific items

crisp island
#

im concerned without trying it first with like five things,

- define foods taco|burrito|lasagna
- define total 128
- foreach <[foods]> as:food:
  - define count <util.random.int[1].to[<[total]>]>
  - define food.<[food]>.quantity:<[count]>
  - define total <[total].-[<[count]>]>

is this what you meant?

chrome smelt
#

oh no I havent thought of that

crisp island
#

because i feel like the first loop is only going to choose 1 through 128, then the second would be 1-10 if the first loop takes 118 for example

#

and then lasagna is left with scraps SAD

chrome smelt
#
- repeat <[amount_of_items]>:
    - if <[chance]> >= 20:
      - define foods.gyro.quantity:++
      - repeat next
    - else if x:
      - define foods.burger.quantity:++
      - repeat next
#

thought of this

crisp island
#

oh, i guess i kinda just expected we'd have a tag for concatenating an inventory, like, organizing it

dense bridge
#

I think

#

!t InventoryTag.include

blissful tinselBOT
dense bridge
#

Might do that? but honestly I'd say creating it properly would be better then tossing random items in and than having it sort them

crisp island
#

yeahh i ended up going a simple route

create_starter_kit:
  type: task
  debug: false
  script:
    - define items <list>
    - define items <[items].include[<list[golden_gyro|sweet_gyro|spicy_gyro].proc[starter_random_foods].context[3]>]>
    - define items <[items].include[phantom_membrane[quantity=20]]>
    - define items <[items].include[firework_rocket[quantity=64]]>
    - define items <[items].include[<list[gyro|hamburger|sandwich].proc[starter_random_foods].context[12]>]>
    - define starter_kit <item[starter_kit].with[inventory_contents=<[items]>]>
starter_random_foods:
  type: procedure
  definitions: foods|quantity
  script:
    - define food_items <list>
    - define foods_list <[foods].parse[repeat_as_list[<[quantity]>]].combine.random[<[quantity]>]>
    - foreach <[foods]> as:food:
      - define food_quantity <[foods_list].count[<[food]>]>
      - foreach next if:<[food_quantity].is_less_than_or_equal_to[0]>
      - define food_items <[food_items].include_single[<[food].as[item].with[quantity=<[food_quantity]>]>]>
    - determine <[food_items]>
#

tyvm