Paste #16193: Edit of P#16192 - custom objects sample v0.01 subject to change

Date: 2015/06/02 21:01:46 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


my_custom_object:
    type: custom
    custom_tags:
        food_amount:
        - determine "<this.eleven> of <this.taco>"
    custom_mechs:
        add_food:
        - if <context.value> == "potato" {
          - adjust <this> eleven:<this.eleven.add[1]> save:new_obj
          - determine <entry[new_obj].result>
          }
          else {
          - determine <this>
          }
    eleven: 11
    taco: potato

test_comand:
    type: command
    name: test_custom
    script:
    - define temp <new[my_custom_object]>
    - narrate <def[temp]>
    # Narrated: "custom@my_custom_object[eleven=11;taco=potato]"
    - adjust <def[temp]> eleven:12 save:new_obj
    - narrate <entry[new_obj].result>
    # Narrated: "custom@my_custom_object[eleven=12;taco=potato]"
    - adjust <entry[new_obj].result> add_food:potato save:new_obj2
    - narrate <entry[new_obj2].result>
    # Narrated: "custom@my_custom_object[eleven=13.0;taco=potato]"
    - narrate <entry[new_obj2].result.eleven>
    # Narrated: "12.0"
    - narrate <entry[new_obj2].result.food_amount>
    # Narrated: "13.0 of potato"