Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: kent79 on November 13, 2020, 09:48:46 AM

Title: Coding Help - Find a Particular Word in game title
Post by: kent79 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
Title: Re: Coding Help - Find a Particular Word in game title
Post by: zpaolo11x 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
Title: Re: Coding Help - Find a Particular Word in game title
Post by: kent79 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