Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Display Player Username v1.0
- #-- Creep out the player by displaying their computer username ingame!
- #-- By mjshi
- #-------------------------------------------------------------------------------
- # **Usage**
- #-------------------------------------------------------------------------------
- # In an event, create a new Script command (tab 3) and type in
- # getUsername
- # and type \V[variable id] in a dialogue box to display it.
- #
- # In conditional branch script evals, you can type
- # name
- # as a shortcut for comparing stuff instead of typing in $game_variables[id].
- #-------------------------------------------------------------------------------
- # **More Built-In Functions For Conditional Branches**
- # You can give it as many things as you want, but they have to be in quotes!
- #-------------------------------------------------------------------------------
- # nameStartsWith(*things)
- #-- ex nameStartsWith("Admin", "C")
- #-- ex nameStartsWith("A", "B", "C", "D")
- #-- checks if the player's username starts with "Admin" or "C", such as
- # something like "Administrator" or "Computer" or "Cassie" etc
- #-- the second one checks if the name starts with any of the four letters.
- #
- # nameEndsWith(*things)
- #-- same as above but it checks if the name ends with the stuff now.
- #
- # nameIs(*things)
- #-- ignores spaces, checks if the name is exactly equal to a thing.
- #-------------------------------------------------------------------------------
- # Installation: Put anywhere above Main.
- #-------------------------------------------------------------------------------
- module DisplayPlayerUsername
- #-----------------------------------------------------------------------------
- # **CONFIGURATION**
- #-----------------------------------------------------------------------------
- # Store the username in which variable?
- StoreIn = 1
- #-----------------------------------------------------------------------------
- end
- def getUsername
- $game_variables[DisplayPlayerUsername::StoreIn] = ENV['username']
- end
- def name
- return ENV['username']
- end
- def nameStartsWith(*things)
- n = name.downcase.strip
- things.each do |thing|
- t = thing.downcase
- return true if n.start_with? t
- end
- return false
- end
- def nameEndsWith(*things)
- n = name.downcase.strip
- things.each do |thing|
- t = thing.downcase
- return true if n.end_with? t
- end
- return false
- end
- def nameIs(*things)
- n = name.downcase.strip
- things.each do |thing|
- t = thing.downcase
- return true if n == t
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement