Archived

This topic is now archived and is closed to further replies.

Tatsude K. Hitori

Real Name Script?

25 posts in this topic

I was wondering if there is a script that whenever used will have the in-game characters say your real name, or at least what your windows username is. The command \N[1] is used for the person to say the name of the first actor. I was wondering if there is a script that would allow what I want.

Share this post


Link to post
Share on other sites

save the PLAYER 'real name' in an ACTOR.  (name input processing)

and then just do \N(actor_id)

 

this could apply naming CASTLE, ARMY, TOWN, QUIZ ANSWER, etc too.

Share this post


Link to post
Share on other sites

You could also just make a blank character that you name for you and call that when needed.

Share this post


Link to post
Share on other sites

I suppose, but it would be cool to shock the player unexpectingly with the game talking to you.

Share this post


Link to post
Share on other sites

Well, It would only look for your windows username instead of the name used in-game.

Share this post


Link to post
Share on other sites

Games that do this could be deleted from the PC by the player faster than you think.

 

If a program could get that name, then it needs access to the user administration of windows. And even read-only-access in that area would mean that the game has left the "sandbox" of its assigned rights - same as a trojan or similiar forms of malware.

 

If such an access is part of a program, most people who think about the consequences would probably delete it as it creates a hole in their computer's protection - if it even succeeds, as many antivirus programs, the newer CPU execution protections and several firewalls are designed to look for those access-tries, block them and report the program doing them as infected by a virus...

Share this post


Link to post
Share on other sites

hmm rereading the post. i think the OP means like DS games which can detect automatically the name we set in DS system.

you need win32api knowledge to achieve that perhaps.

http://stackoverflow.com/questions/953954/whats-wrong-with-getusername-win32-api

apparently using GetUserNameEx function

 

http://www.rubytips.org/2008/05/13/accessing-windows-api-from-ruby-using-win32api-library/

you can assign it to variable

hope this help

Share this post


Link to post
Share on other sites

well that's understandable for handheld and consoles coz they are made for gaming, but doing that in a desktop/laptop whatever has more impact actually...

Share this post


Link to post
Share on other sites

Mine is Terminal-001 (for my main pc) or LT-001 (laptop) or SRV-001 (server), etc.

 

The windows usernames are like "Anonymous", "Private", "Developer, "Admin", etc... It makes really no sense on a PC.

Share this post


Link to post
Share on other sites

you could store the window user name to an actor name (MC and one other dummy actor if necessary). if above link code is right... you need to put it in a module and rename the method to contain self.

ex:

Module Estrioledef self.getComputerName    name = " " * 128    size = "128"    Win32API.new('kernel32','GetComputerName',['P','P'],'I').call(name,size)    return name.unpack("A*")  end    # Returns current logged in Windows user name  def self.getUserName    name = " " * 128    size = "128"    Win32API.new('advapi32','GetUserName',['P','P'],'I').call(name,size)    return name.unpack("A*")  end  end

then at start of the game. make autorun event with this script call:

$game_actors[x].name = ESTRIOLE.getUserName

change x to any actor id you want.

 

then you could do input name processing to MC. and it simulate like the DS handheld. (in DS when we named the character usually they set our DS system name first). so if the window username is not valid for a character name. they're not punished and could still rename the actor. but for some computer that have their username with their real name (many do so). it would be a little nice warm greeting from the developer to the player.

 

and whenever you need the username just use

ESTRIOLE.getUserName

or set it in variable so you could use \v[x] in message.

 

but if the code from above link is working. didn't test it myself. also someone in the net said it's better to use GetUserNameEx instead. so you can define the format. but i don't know how to use it.

Gambit likes this

Share this post


Link to post
Share on other sites

Well, using the code from Estriole's post, this would be pretty easy to finish up... Hopefully he doesn't mind if I make a few changes.

module ESTRIOLE   def self.getUserName      name = " " * 128      size = "128"      Win32API.new('advapi32','GetUserName',['P','P'],'I').call(name,size)    return name.unpack("A*").to_s[2..-3]  endend

Changes made: fixed capitalization of module, capitalized ESTRIOLE to match recommended script call, added basic formatting to string

 

Then, just like Estriole said, use this script call in an event to change actor x's name to the logged-in username:

$game_actors[x].name = ESTRIOLE.getUserName

Also, remember to include an option for the character to change actor x's name to whatever they want in case the player's PC username is not what they want to use. You don't want the player to be stuck with it.

estriole likes this

Share this post


Link to post
Share on other sites

Alternatively you can use the ENV class to fetch the necessary enviroment variables.

 

ENV['COMPUTERNAME']ENV['USERNAME']ENV['USERDOMAIN']print "#{ENV['USERNAME']}@#{ENV['USERDOMAIN']}"print "#{ENV['USERDOMAIN']}\\#{ENV['USERNAME']}"

 

*hugs*

Archeia, estriole and Tsukihime like this

Share this post


Link to post
Share on other sites

Alternatively you can use the ENV class to fetch the necessary enviroment variables.

ENV['COMPUTERNAME']ENV['USERNAME']ENV['USERDOMAIN']print "#{ENV['USERNAME']}@#{ENV['USERDOMAIN']}"print "#{ENV['USERDOMAIN']}\\#{ENV['USERNAME']}"

*hugs*

hmmm first time hearing ENV class. what  other thing the class can do except the example above?

Share this post


Link to post
Share on other sites

i did and it shown as

ENV

 

finally able to see what inside by printing

ENV.to_hash

and it contain interesting things.

Share this post


Link to post
Share on other sites

ENV is a hash.

I don't know how you're printing stuff to console. I just say

p ENV

Share this post


Link to post
Share on other sites

i use

puts ENV

which basically the same as p ENV (i dislike using only p for print in script since hard to search and it sorta become habit. so when i need to remove it i ctrl+shift+f puts... :D)

and it shown in console as

ENV

 

try that if you don't trust me

 

i use

puts ENV.to_hash

is after googling it.... and found this page

http://www.ruby-doc.org/core-2.0/ENV.html

 

in that page explained

ENV is a hash-like accessor for environment variables.

so not a real hash... just hash-like

and it has method

to_hash to return a 'real' hash with the ENV variables.

 

so ENV is not a hash. that's why when we print it will only shown ENV

Share this post


Link to post
Share on other sites

Technically ENV is not a hash. It does appear to be closely related.

msgbox ENV.is_a?(Hash)msgbox (ENV.methods - Hash.new.methods()).sizemsgbox (Hash.new.methods() - ENV.methods).sizemsgbox_p *(Hash.new.methods() - ENV.methods)

Now since you have looked up how ENV works you can tell me a potential danger of using it.

 

*hugs*

 

P.s. as a nitpick p prints the inspection of objects to the console.

Share this post


Link to post
Share on other sites

Clearly not since `puts ENV` only shows ENV while `p ENV` displays it as a hash.

http://stackoverflow.com/questions/1255324/p-vs-puts-in-ruby

It isn't hard to find lone p's either using ctrl+shift+f

ah thanks for the confirmation. i though both of them is the same :D.

also helpful link. apparently using puts will affected if the class have .to_s method...

should change to p then >.<.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.