Author Topic: first character  (Read 250 times)

yomismogarcia

  • Newbie
  • *
  • Posts: 5
    • View Profile
first character
« on: December 30, 2016, 03:58:20 AM »

How can I get the first character of a text string stored in a variable?

Thank in advance

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
    • View Profile
Re: first character
« Reply #1 on: December 30, 2016, 06:13:41 AM »

yomismogarcia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: first character
« Reply #2 on: December 31, 2016, 06:13:52 AM »
 :) :) :) :)


thanks

Favdeacon

  • Full Member
  • ***
  • Posts: 41
    • View Profile
Re: first character
« Reply #3 on: June 12, 2017, 02:49:44 PM »
Thanks from me, too. I needed to shorten the number of players string from nplayers.ini (e.g. "2P alt" to just "2"). In case someone wants that, too:

Code: [Select]

function playerStripped()
 {
        local pstrip = fe.game_info(Info.Players).slice(0,1);
        return pstrip;
 }
 
local playerText = fe.add_text( "Players: [!playerStripped]", x, y, w, h );