.rc LUA help


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

User avatar

Slime Squisher

Posts: 338

Joined: Wednesday, 20th November 2013, 11:37

Post Wednesday, 4th May 2016, 08:11

.rc LUA help

A friend of mine wants his character tile to be changed while he levels up.
I just don't know what function is called when you level up. And whether tile_player_tile works without save&restarting or not.

Where can I see all crawl functions that I can use?

Vaults Vanquisher

Posts: 428

Joined: Friday, 17th December 2010, 22:07

Post Wednesday, 4th May 2016, 21:32

Re: .rc LUA help

"a friend of mine" ...

Slime Squisher

Posts: 395

Joined: Monday, 28th April 2014, 19:50

Post Thursday, 5th May 2016, 02:02

Re: .rc LUA help

ololoev wrote:A friend of mine wants his character tile to be changed while he levels up.
I just don't know what function is called when you level up. And whether tile_player_tile works without save&restarting or not.

Where can I see all crawl functions that I can use?


It's not a default function in crawl, it's a lua script by Gammafunk:
https://github.com/gammafunk/dcss-rc
(crawl does have the option to change the player tile, but it's the script which can automatically change it over time)

To use it with the default settings (which changes tiles every 100 turns as well as on levelup), you can just add
include += RandomTiles.rc
to your rc file. Note that this should only work on the CAO and CBRO servers.

Otherwise you can just copy the contents of the randomtiles.rc on that github.

For this message the author genericpseudonym has received thanks:
ololoev
User avatar

Slime Squisher

Posts: 338

Joined: Wednesday, 20th November 2013, 11:37

Post Thursday, 5th May 2016, 07:07

Re: .rc LUA help

genericpseudonym wrote:It's not a default function in crawl, it's a lua script by Gammafunk:
https://github.com/gammafunk/dcss-rc

TY for the link, but can anybody tell me how it is invoked every UI action? Where is the starting point?

Swamp Slogger

Posts: 162

Joined: Wednesday, 4th May 2016, 06:04

Post Thursday, 5th May 2016, 07:34

Re: .rc LUA help

Try this: look at the readme at that link. In the section on installation he shows you how to make a ''ready function'' which will run each turn. There you should invoke a previously defined function where you check the character's xl (I think you can use you.xl() to do this) and, if it has changed since the last turn, then invoke the gammafunk's function for changing the tile. (I don't know if there is a better way to do this than checking the output of you.xl() each turn.)

EDIT: Adding this in the rcfile underneath where I pasted in the contents of gammafunk's file RandomTiles.rc seemed to do the trick for me.

  Code:
<

  function tileUp()
    oldExpLevel = you.xl()
    new_random_tile()
  end

oldExpLevel = ""


  function ready()
    if (you.xl() ~= oldExpLevel) then
      tileUp()
    end
  end
>


I used 'new_random_tile()' to just get a new random tile on levelup; you might want to use 'set_tile_by_name()' instead, to get a particular tile from gammafunk's list.

For this message the author andreas has received thanks:
ololoev

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: No registered users and 14 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.