Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] searching within a string

Status
Not open for further replies.
Is there any way to test if a string contains a specified "substring?"

example:
Code:
if the player name contains "ion" anywhere
  print "nice name"
else
  print "You suck"
end

"alexus" would print "You suck"
"ionizer" would print "nice name"
"prionic" would print "nice name"
"Jessica Fiona Alexander III" would print "nice name"
"Big oinker" would print "You suck"

Is it possible to do this in rmxp? and if so,
How?[/FONT]
 

Anonymous

Guest

Conditional branch with the script option.

Type this in the conditional branch script text field:

$game_actors[id].name.include?("ion")

Replacing id with the actor id and ion with whatever substring you want.
 
This topic has been resolved. If DraycosGoldaryn or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top