Author Topic: Coding Help - Find a Particular Word in game title  (Read 140 times)

kent79

  • Hero Member
  • *****
  • Posts: 644
    • View Profile
Coding Help - Find a Particular Word in game title
« on: November 13, 2020, 09:48:46 AM »
I have some idea and don't know the real code. Please give me help if you known. Thanks.

- Check out the game title like as "Alien3: The Gun (World)"
- Checking word = "(World)"
- if word found, do something

zpaolo11x

  • Hero Member
  • *****
  • Posts: 975
    • View Profile
    • My deviantart page
Re: Coding Help - Find a Particular Word in game title
« Reply #1 on: November 13, 2020, 11:14:24 AM »
Code: [Select]
function checkworldinname(){
    local gamename = fe.game_info (Info.Title)
    return (gamename.find ("(World)") != null)
}

should do the trick, the function gets the title of the current name and look in the string for the substring "(World)", if the result is not null then the substring is there

kent79

  • Hero Member
  • *****
  • Posts: 644
    • View Profile
Re: Coding Help - Find a Particular Word in game title
« Reply #2 on: November 13, 2020, 09:21:55 PM »
Thank you for your help. It is very useful. The function has been added to the theme. Thanks

http://forum.attractmode.org/index.php?topic=3792.0