Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Routine: Rename Object

ricochet1k edited this page Oct 31, 2012 · 3 revisions

with {object} as {desired name} [, {object2} as {name2} [, ...]]

With is mainly used to rename long objects to short ones. For example, if you are using a tag name a lot in a certain event, instead of using attacker_tag_some_crazy_long_tag_name everywhere, you could add a with attacker_tag_some_crazy_long_tag_name as xyz and then use xyz everywhere. It's also useful if you have a routine alias which you want to use in multiple incompatible events. Example:

Aliases:
    Routine:
        gamble:
            - 'if player.hasallitems.gold_nugget*4':
                - 'player.takeitems.gold_nugget*4'
                - 'if chance.1':
                    - 'player.giveitem.gold_nugget*20'
                    - 'message.player': "You're a lucky winner!"
Command:
    - 'gamble':
        - 'with sender as player': '_gamble'
Interact:
    - 'if interact_right and interact_block.type.gold_block':
        - '_gamble' # with not needed here
Damage:
    - 'if attacker.type.player and target.type.pigzombie': # good luck keeping any nuggets
        - 'with attacker as player'
            - '_gamble'
Clone this wiki locally