Anonymous

Mod Creation/Sidebar API Reference: Difference between revisions

From Melvor Idle
Fix incorrect IDs for sidebar skills
(Use SyntaxHighlight)
(Fix incorrect IDs for sidebar skills)
 
(3 intermediate revisions by the same user not shown)
Line 186: Line 186:


  <syntaxhighlight lang="js" line>// Move Astrology above Firemaking
  <syntaxhighlight lang="js" line>// Move Astrology above Firemaking
sidebar.category('Non-Combat').item('Astrology', { before: 'Firemaking' });
sidebar.category('Non-Combat').item('melvorD:Astrology', { before: 'melvorD:Firemaking' });


// Create a new item and add a subitem beneath it
// Create a new item and add a subitem beneath it
Line 203: Line 203:
'''Example'''
'''Example'''


  <syntaxhighlight lang="js" line>sidebar.category('Combat').removeItem('Attack');</syntaxhighlight>
  <syntaxhighlight lang="js" line>sidebar.category('Combat').removeItem('melvorD:Attack');</syntaxhighlight>


=== removeAllItems(): void ===
=== removeAllItems(): void ===
Line 290: Line 290:


  <syntaxhighlight lang="js" line>// Navigate to the Woodcutting page
  <syntaxhighlight lang="js" line>// Navigate to the Woodcutting page
sidebar.category('Non-Combat').item('Woodcutting').click();</syntaxhighlight>
sidebar.category('Non-Combat').item('melvorD:Woodcutting').click();</syntaxhighlight>


=== toggle(force?: boolean): void ===
=== toggle(force?: boolean): void ===
Line 316: Line 316:


  <syntaxhighlight lang="js" line>// Removes the Summoning skill from the sidebar
  <syntaxhighlight lang="js" line>// Removes the Summoning skill from the sidebar
sidebar.category('Non-Combat').item('Summoning').remove();</syntaxhighlight>
sidebar.category('Non-Combat').item('melvorD:Summoning').remove();</syntaxhighlight>


=== subitem(id: string, config?: SubitemConfig, builder?: (subitem: Subitem) => void): Subitem ===
=== subitem(id: string, config?: SubitemConfig, builder?: (subitem: Subitem) => void): Subitem ===
Line 342: Line 342:


// Add a shortcut to Alt. Magic beneath Magic
// Add a shortcut to Alt. Magic beneath Magic
sidebar.category('Combat').item('Magic').subitem('Alt. Magic', {
sidebar.category('Combat').item('melvorD:Magic').subitem('Alt. Magic', {
   onClick() {
   onClick() {
     sidebar.category('Non-Combat').item('Alt. Magic').click();
     sidebar.category('Non-Combat').item('melvorD:Magic').click();
   }
   }
});</syntaxhighlight>
});</syntaxhighlight>