Macros
From LugdunonWiki
Revision as of 16:51, 15 February 2015 by SuperHawksman (Talk | contribs)
|
|
Introduction
This page showcases macros that you might wish to incorporate into your gameplay. If you have a macro that you would like to see added, send it in an email to lugdunondev@gmail.com for review and possible inclusion here, with credit to you!
Set Lighting LOD (Level of Detail)
This macro will cycle through 3 different light maps of differing quality:
- function(macro)
- {
- var lod=game.getCurrentGameState().environment.getLOD()+1;
- if(lod > 3)
- {
- lod=1;
- }
- game.getCurrentGameState().environment.setLOD(lod);
- game.console.log("Lighting LOD (Level of Detail) is now: "+lod);
- }
Consume Food
This macro will search your action bar and inventory for food, and attempt to consume the first food item it finds:
- function(macro)
- {
- var p;
- var i;
- var ii;
- for(i=0;i<net.lugdunon.character.Character.ACTION_PLAY_SIZE;i++)
- {
- ii=game.player.getInventoryItem(
- net.lugdunon.character.Character.ACTION_PLAY_BLOCK,
- i
- );
- if(ii && ii.itemDef && (ii.itemDef.getItemType() == "FOOD"))
- {
- p={
- blockType :net.lugdunon.character.Character.ACTION_PLAY_BLOCK,
- blockIndex:i
- };
- break;
- }
- }
- if(!p)
- {
- for(i=0;i<net.lugdunon.character.Character.INVENTORY_SIZE;i++)
- {
- ii=game.player.getInventoryItem(
- net.lugdunon.character.Character.INVENTORY_BLOCK,
- i
- );
- if(ii && ii.itemDef && (ii.itemDef.getItemType() == "FOOD"))
- {
- p={
- blockType :net.lugdunon.character.Character.INVENTORY_BLOCK,
- blockIndex:i
- };
- break;
- }
- }
- }
- if(!p)
- {
- game.console.log("You have no food.","#F00");
- }
- else
- {
- game.client.sendCommand(
- game.client.buildCommand(
- "CORE.COMMAND.CONSUME.FOOD",
- p
- )
- );
- }
- }