Jump to content


Photo

[Solved]Movement settings using INI


  • Please log in to reply
5 replies to this topic

#1 Aragon

Aragon

    GMC Member

  • GMC Member
  • 138 posts

Posted 26 May 2011 - 08:06 PM

Yo folks,
I'm using Powerful Ini File Management To read the game player settings out of an INI file.
But i'm have some troubles by using the vk_(key). how could I solve this?
The error he gives: it don't chance the string into an ASCII code which GM could use as an command. instand it returns it into 0.

global.keyRunning_get=rini_read_string(settings,"GAMEPLAY_SET","Run",vk_shift);
global.keyMovement_jump_get=rini_read_string(settings,"GAMEPLAY_SET","Jump",vk_space);
global.keyChat_get=rini_read_string(settings,"GAMEPLAY_SET","Chat","Y");
global.keyScore_display_get=rini_read_string(settings,"GAMEPLAY_SET","Score_display",vk_tab);

EDIT
[Solved]
changed the rini_read_string into rini_read_real.

Edited by Aragon, 27 May 2011 - 07:02 AM.

  • 0

#2 Big J

Big J

    GMC Member

  • GMC Member
  • 2818 posts
  • Version:GM8.1

Posted 26 May 2011 - 09:47 PM

Keycodes are real values, not strings.
global.keyRunning_get = rini_read_real(settings, "GAMEPLAY_SET", "Run", vk_shift);
global.keyMovement_jump_get = rini_read_real(settings, "GAMEPLAY_SET", "Jump", vk_space);
global.keyChat_get = rini_read_real(settings, "GAMEPLAY_SET", "Chat", ord('Y'));
global.keyScore_display_get = rini_read_real(settings, "GAMEPLAY_SET", "Score_display", vk_tab);

Edited by Big J, 26 May 2011 - 09:52 PM.

  • 0

#3 Aragon

Aragon

    GMC Member

  • GMC Member
  • 138 posts

Posted 27 May 2011 - 06:23 AM

Keycodes are real values, not strings.

global.keyRunning_get = rini_read_real(settings, "GAMEPLAY_SET", "Run", vk_shift);
global.keyMovement_jump_get = rini_read_real(settings, "GAMEPLAY_SET", "Jump", vk_space);
global.keyChat_get = rini_read_real(settings, "GAMEPLAY_SET", "Chat", ord('Y'));
global.keyScore_display_get = rini_read_real(settings, "GAMEPLAY_SET", "Score_display", vk_tab);

Is there any way to change it into a string this doesn't work:

global.keyRunning = string(global.keyRunning_get)

  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16784 posts
  • Version:GM:Studio

Posted 27 May 2011 - 06:46 AM

But why do you need a string? All the keys on your keyboard have an ascII value (numeric) which will work fine in all keyboard checks. Test it! Just do something like

//create event of object
keyboard_wait();
key=keyboard_lastkey();

//Step event
if keyboard_check_pressed(key) show_message("You pressed the key!")

//draw event
draw_text(32,32,key);

If you want further example check out my tutorial HERE...
  • 0

#5 Canite

Canite

    Canigget

  • GMC Member
  • 1358 posts
  • Version:GM8

Posted 27 May 2011 - 06:51 AM

I was going to suggest Nocturne's tutorial, but I see he already posted it ^_^
I still highly suggest using his tutorial though, I use it a lot :)
  • 0

#6 Aragon

Aragon

    GMC Member

  • GMC Member
  • 138 posts

Posted 27 May 2011 - 07:01 AM

That example looks good, but i find out myself, had to write it in a real not in a string -.-' stupid me:P

ThQ for spending time on this.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users