Jump to content


Photo

Real Name Script?

Script Request

This topic has been archived. This means that you cannot reply to this topic.
24 replies to this topic

#1 Tatsude K. Hitori

Tatsude K. Hitori

    Dragonian

  • Members
  • 114 posts

Posted 16 June 2013 - 10:32 AM

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.


Ahnok fahdon.


#2 estriole

estriole

    Advanced Member

  • Members
  • 534 posts

Posted 16 June 2013 - 08:33 PM

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.



#3 Rello

Rello

    Rello

  • Members
  • 206 posts

Posted 16 June 2013 - 09:34 PM

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



#4 Tsukihime

Tsukihime

    Advanced Member

  • Members
  • 5,760 posts

User's Awards

        

Posted 16 June 2013 - 11:35 PM

You should ask the user for his name instead of snooping around his computer.
My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#5 Tatsude K. Hitori

Tatsude K. Hitori

    Dragonian

  • Members
  • 114 posts

Posted 17 June 2013 - 02:23 PM

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


Ahnok fahdon.


#6 Dekita

Dekita

    Diabolical Codemaster

  • Members
  • 2,750 posts

User's Awards

        

Posted 19 June 2013 - 10:36 AM

what if the player (like me) has a different username on their pc from the name they use in games ? if they cannot change it... i know i wouldn't be too pleased :)


D13x_Banner.pngRGSS_Banner.pngPi_NG_Banner.pngEUA_Banner.pngMNK_Baner.pngDekyde_Banner.png

TCG_Banner.png

FK6sdj2.png


#7 Tatsude K. Hitori

Tatsude K. Hitori

    Dragonian

  • Members
  • 114 posts

Posted 19 June 2013 - 11:49 AM

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


Ahnok fahdon.


#8 Andar

Andar

    Advanced Member

  • Moderators
  • 6,770 posts

Posted 19 June 2013 - 12:58 PM

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...



#9 estriole

estriole

    Advanced Member

  • Members
  • 534 posts

Posted 19 June 2013 - 10:53 PM

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...rname-win32-api

apparently using GetUserNameEx function

 

http://www.rubytips....n32api-library/

you can assign it to variable

hope this help


Edited by estriole, 19 June 2013 - 11:01 PM.


#10 Engr. Adiktuzmiko

Engr. Adiktuzmiko

    Chemical Engineer, Game Developer, Using BlinkBoy's Avatar

  • Member+
  • 7,548 posts

User's Awards

     

Posted 20 June 2013 - 12:01 AM

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...


Edited by adiktuzmiko, 20 June 2013 - 12:01 AM.


#11 Dekita

Dekita

    Diabolical Codemaster

  • Members
  • 2,750 posts

User's Awards

        

Posted 20 June 2013 - 05:09 AM

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

my windows username is USER-PC... i sure as hell dont want that in my game :P


Edited by Dekita, 20 June 2013 - 05:09 AM.

D13x_Banner.pngRGSS_Banner.pngPi_NG_Banner.pngEUA_Banner.pngMNK_Baner.pngDekyde_Banner.png

TCG_Banner.png

FK6sdj2.png


#12 Napoleon

Napoleon

    Advanced Member

  • Members
  • 844 posts

Posted 20 June 2013 - 09:47 AM

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.


The Devil's Deal Progress: Sig.png
My Scripts Collection & Demo

#13 Tatsude K. Hitori

Tatsude K. Hitori

    Dragonian

  • Members
  • 114 posts

Posted 20 June 2013 - 10:39 AM

Well, my username on Windows is TRBagon.


Ahnok fahdon.


#14 estriole

estriole

    Advanced Member

  • Members
  • 534 posts

Posted 20 June 2013 - 08:33 PM

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 Estriole
def 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.


Edited by estriole, 20 June 2013 - 08:36 PM.


#15 Gambit

Gambit

    Member

  • Members
  • 12 posts

Posted 22 June 2013 - 02:56 AM

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]
  end
end

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.


Edited by Gambit, 22 June 2013 - 03:39 AM.


#16 Tatsude K. Hitori

Tatsude K. Hitori

    Dragonian

  • Members
  • 114 posts

Posted 22 June 2013 - 05:02 PM

Awesome! I'm going to test it right now.


Ahnok fahdon.


#17 Zeriab

Zeriab

    Huggins!

  • Member+
  • 361 posts

Posted 23 June 2013 - 03:18 AM

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*


ZeriabSig.png


#18 estriole

estriole

    Advanced Member

  • Members
  • 534 posts

Posted 23 June 2013 - 08:14 PM

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?


Edited by estriole, 23 June 2013 - 08:16 PM.


#19 Tsukihime

Tsukihime

    Advanced Member

  • Members
  • 5,760 posts

User's Awards

        

Posted 23 June 2013 - 09:17 PM

Just print out ENV to console.
My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#20 estriole

estriole

    Advanced Member

  • Members
  • 534 posts

Posted 23 June 2013 - 10:12 PM

i did and it shown as

ENV

 

finally able to see what inside by printing

ENV.to_hash

and it contain interesting things.