Entity Tutorial 4: Usable Object: Difference between revisions

From SkyCorp Global
Jump to navigation Jump to search
 
(This tutorial page got lost some years ago, I think. Fixing up)
Tags: Removed redirect Visual edit
 
Line 1: Line 1:
#REDIRECT [[Dick Size Increaser]]
The [https://skycorp.global/skyscript/mods/view.php?modID=2&showJson=1&showLua=1 Dick Size Increaser mod] demonstrates how to modify the player object:<syntaxhighlight lang="lua">
function doUse()
 
  -- Write to the screen.
  io.write("Changing player\n");
 
  -- Get the instance of the Player class and store it in variable 'player'
  player = Player.getInstance();
 
  -- An example of accessing a player property and displaying it.  Note that
  -- usually it would be easier to just use the text parser for something this
  -- simple, however this demonstrates accessing the player object.
  io.write("You look down at your " .. player.getDickSizeString() .. ".  ");
 
  -- Transforms player's dick to be larger.  This version of the function will
  -- output text to the screen, but other silent versions are available.
  player.tfDickLarger();
 
  -- Display the property again now just for testing purposes to show that the
  -- player has changed.
  io.write("It now looks like a " .. player.getDickSizeString() .. ".\n");
 
  -- For the use() function, returning true will cause a continue scene to be
  -- displayed next.  In other words, processing will paused and a "Continue.."
  -- button will be displayed.  If you want to manage the scene transition yourself
  -- or display custom buttons, you would need to set those up and return false,
  -- however, that is rare.
  return true;
end
</syntaxhighlight>

Latest revision as of 05:37, 7 June 2024

The Dick Size Increaser mod demonstrates how to modify the player object:

function doUse()

   -- Write to the screen.
   io.write("Changing player\n");

   -- Get the instance of the Player class and store it in variable 'player'
   player = Player.getInstance();

   -- An example of accessing a player property and displaying it.  Note that
   -- usually it would be easier to just use the text parser for something this
   -- simple, however this demonstrates accessing the player object.
   io.write("You look down at your " .. player.getDickSizeString() .. ".  ");

   -- Transforms player's dick to be larger.  This version of the function will 
   -- output text to the screen, but other silent versions are available.
   player.tfDickLarger();

   -- Display the property again now just for testing purposes to show that the 
   -- player has changed.
   io.write("It now looks like a " .. player.getDickSizeString() .. ".\n");

   -- For the use() function, returning true will cause a continue scene to be
   -- displayed next.  In other words, processing will paused and a "Continue.."
   -- button will be displayed.  If you want to manage the scene transition yourself
   -- or display custom buttons, you would need to set those up and return false,
   -- however, that is rare.
   return true;
end