Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Putting name into the game, when talking to somone, etc.  (Read 2207 times)

0 Members and 1 Guest are viewing this topic.
Putting name into the game, when talking to somo...
« on: June 26, 2007, 05:21:17 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Hey
Okay, so I've been trying a lot of things to put the name you enter on the registration screen, to appear when you read a sign, for example.
This is what I have done:
Code: [Select]
global.name = ini_open('Player' + string(argument0) + '.mgb'); name = ini_read_string('Player', 'name', '');And then when you read the sign:
Code: [Select]
Message("Your name is: "+global.name+". ")
I know for sure that the top code is right, but when I go to read the sign, I get the error:
Code: [Select]
ERROR in
action number 3
of Key Press Event for Z-key Key
for object objTestRoomSign1:

Error in code at line 1:
   Message("Your name is: "+global.name+". ")

at position 33: Wrong type of arguments to +.

So I go to erase the two "+"
Then when I play the game again, I get this error:
Code: [Select]
FATAL ERROR in
action number 3
of Key Press Event for Z-key Key
for object objTestRoomSign1:

COMPILATION ERROR in code action
Error in code at line 1:
   Message("Your name is: "global.name". ")

at position 25: Symbol , or ) expected.

So I am getting kinda frustrated with this.
Can anyone help?

Thanks
-Mewgull
Logged
Re: Putting name into the game, when talking to ...
« Reply #1 on: June 26, 2007, 06:18:26 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2890
Code: [Select]
Message("Your name is: "+global.name+". ")
into

Code: [Select]
Message("Your name is: "+string(global.name)+". ")
Logged
Re: Putting name into the game, when talking to ...
« Reply #2 on: June 26, 2007, 06:29:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
in your code global.name is a number

Code: [Select]
ini_open('Player' + string(argument0) + '.mgb');
global.name = ini_read_string('Player', 'name', '');
ini_close();

Logged
Re: Putting name into the game, when talking to ...
« Reply #3 on: June 26, 2007, 07:17:04 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Thanks for the help you two.
I used both of your codes, and I don't get any errors, but when I read the sign:
"your name is: ."
It just doesn't show at all..
Logged
Re: Putting name into the game, when talking to ...
« Reply #4 on: June 26, 2007, 08:46:33 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
Show us the contents of your ini file
Logged
Re: Putting name into the game, when talking to ...
« Reply #5 on: June 26, 2007, 10:05:10 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
here:

[Player]
name=Mewgull
[Heart Containers]
amount=3
pieces=0
double_defence=0
[Rupees]
wallet=1
amount=0
[Remains]
odolwa=0
goht=0
gyorg=0
twinmold=0
[Masks]
amount=0
[Location]
current=Started
Logged
Re: Putting name into the game, when talking to ...
« Reply #6 on: June 26, 2007, 11:01:47 pm »
  • Oh.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 579
Im not experienced with GM at all, but I think its not a global value, rather a player value?  Message("Your name is: "+string(player.name)+". ")
Logged
Hm.
Re: Putting name into the game, when talking to ...
« Reply #7 on: June 27, 2007, 12:16:17 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
No, the code is fine, it sounds like it's having an issue reading the file.  Add some code in there to check whether the file exists before trying to open it.
Logged

Antidote

>.>
Re: Putting name into the game, when talking to ...
« Reply #8 on: July 01, 2007, 10:56:32 pm »
  • In all seriousness who's serious?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1485
Code: [Select]
global.name = ini_open('Player' + string(argument0) + '.mgb'); <- thats your problemit needs to be
Code: [Select]
ini_open('Player' + string(argument0)+'.mgb');
global.name = ini_read_string('Player', 'name', '');
that WILL work

EDIT:
Just noticed windy's post =/ hmm thats odd. I dunno whats up I'll check your script in GameMaker and tinker with it until it works!

EDIT2:
It worked fine for me. Mewgull check to things:
1) Is the extension of the file .mgb?
2) Is it in the same directory as the executable?
it should work perfectly after you check and make sure both of those are true.
« Last Edit: July 01, 2007, 11:09:08 pm by Antidote »
Logged
  • Axiomatic Data Laboratories

Antidote

>.>
Re: Putting name into the game, when talking to ...
« Reply #9 on: July 02, 2007, 08:52:44 pm »
  • In all seriousness who's serious?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1485
Hey mewgull, can you post the Menu Engine please? that would be helpful for alot of folks and reduce the amount of spammy questions.
Logged
  • Axiomatic Data Laboratories
Re: Putting name into the game, when talking to ...
« Reply #10 on: July 02, 2007, 09:30:36 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
what are the + at the beginning and the end of the global for?
try without it...thats a hard way to make the code.
try something like...wait what program are you using?
Logged
This is an english website, please speak it.
l0l wut? o_0

Antidote

>.>
Re: Putting name into the game, when talking to ...
« Reply #11 on: July 02, 2007, 09:32:07 pm »
  • In all seriousness who's serious?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1485
what are the + at the beginning and the end of the global for?
try without it...thats a hard way to make the code.
try something like...wait what program are you using?
You do that edge and you go to Error hell. he is using GM
Logged
  • Axiomatic Data Laboratories
Re: Putting name into the game, when talking to ...
« Reply #12 on: July 02, 2007, 09:35:46 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
ok, let me make something to see if it is what he wants...it may be it may not be but I use it and it works...just give me a few minutes to upload it.
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Putting name into the game, when talking to ...
« Reply #13 on: July 02, 2007, 09:42:45 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 121
it should be
Code: [Select]
message("your name is:" + string(global.name))
Logged
Re: Putting name into the game, when talking to ...
« Reply #14 on: July 02, 2007, 09:47:33 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
oh I'm late xD
Here http://host-a.net/edge_spearo_0/GetNameEngine.gm6
Maybe what you want, I tried to explain the codes but as I've said I suck at explaining so I just hope you understand.
Logged
This is an english website, please speak it.
l0l wut? o_0

Antidote

>.>
Re: Putting name into the game, when talking to ...
« Reply #15 on: July 02, 2007, 09:59:32 pm »
  • In all seriousness who's serious?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1485
it should be
Code: [Select]
message("your name is:" + string(global.name))
He wanted to add a period at the end thus it is
Code: [Select]
message("your name is:" + global.name+".")wait... WTF are you doing stringing a string?
Logged
  • Axiomatic Data Laboratories
Re: Putting name into the game, when talking to ...
« Reply #16 on: July 02, 2007, 10:06:15 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 121
it should be
Code: [Select]
message("your name is:" + string(global.name))
He wanted to add a period at the end thus it is
Code: [Select]
message("your name is:" + global.name+".")wait... WTF are you doing stringing a string?
well i made it up on the spot so i did not test it or anything and i did not read his own code.
Logged
Re: Putting name into the game, when talking to ...
« Reply #17 on: July 03, 2007, 01:34:16 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
lol, okay thanks guys for your hard work :)

The problem is that it's not showing up at all.  I know for sure that you don't have to put a "string" code in there, becuase on my other games that I used a name, I never had to.  So the problem might be HOW I am activating the "global.name", and possibly where, I should put it.
« Last Edit: July 03, 2007, 03:50:00 pm by Mewgull »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.102 seconds with 71 queries.