Author Topic: [Kit] Simplified KeyConfig Presentation (OSP)  (Read 4445 times)

0 Members and 1 Guest are viewing this topic.

dunde

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
[Kit] Simplified KeyConfig Presentation (OSP)
« on: January 26, 2011, 12:08:47 PM »
If you have implemented some features that need usage of buttons like custom camera, various formation and tactics codes, shield bashing, iwill be better if platyer can customize the buttons configuration. That's the code about.
I made it simplified so it will be ready to use with minimum extra coding. And there's no need for aditional trigger at mission templates either.
All we need is just copy the code to the relevant files, and adding some constants and strings according to our mod need.
It can support up to 30 keys. If there're more than 20 keys, then the buttons arranged by 3 columns, otherwise there will be 2 columns.
(click to show/hide)
(click to show/hide)
(click to show/hide)
(click to show/hide)
(click to show/hide)

Usage :
Just call at any menu, camp menu will be fit :
Code: [Select]
   ("options_key",[],"Control Settings.", [(start_presentation, "prsnt_key_config"),]),   
Modify constants and strings marked by :
#-- Parts to modify as your mod need --------------
« Last Edit: July 29, 2012, 04:12:22 PM by dunde »

Lumos

  • Probably Not a Help Desk
  • Grandmaster Knight
  • *
  • Mens INsana in corpore sano
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • M&BWBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #1 on: January 26, 2011, 01:07:45 PM »
Another good thing from you... :)
I'll certainly investigate it.

rabican

  • Knight at Arms
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: Simplified KeyConfig Presentation (OSP)
« Reply #2 on: April 12, 2011, 09:20:46 PM »
Thanks a lot for this!

Cromcrom

  • Guest
Re: Simplified KeyConfig Presentation (OSP)
« Reply #3 on: April 12, 2011, 10:16:56 PM »
Thank you very much dunde once again. So usefull, and so many things to learn from this :-)

Sayd Ûthman

  • Language Moderator
  • *
  • Tamazgha tga win Imazighen
    • View Profile
  • Faction: Neutral
  • MP nick: Sayd_uthman
  • WB
Re: Simplified KeyConfig Presentation (OSP)
« Reply #4 on: April 12, 2011, 10:18:44 PM »
Dunde you are a genius  :mrgreen:

Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #5 on: April 12, 2011, 11:30:56 PM »
wouldnt it be simpler use global variables instead of slots?


Sorry for my poor English, I'm Brazilian.

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #6 on: April 12, 2011, 11:45:10 PM »
wouldnt it be simpler use global variables instead of slots?
No. You cannot iterate through multiple global variables.
And that would require 1 global variable for the key, another global variable for the associated text, and for the presentation another global variable for the overlay. 3 globals per key you wish to define. Or using 1 faux-troop and whatever number of slots.



Cernunos

  • Sergeant at Arms
  • *
  • A 1000 miles trekk starts with a first step.
    • View Profile
  • Faction: Nord
Re: Simplified KeyConfig Presentation (OSP)
« Reply #7 on: April 29, 2011, 12:29:56 PM »
Hmmm, please guys, copy/pasting from here to notepad makes the whole code be on only one line, and this is very unwieldy. Do you guys would have any tips about this ?

That would be great, thanks in advance.

Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #8 on: April 29, 2011, 10:26:32 PM »
press quote and then copy...


Sorry for my poor English, I'm Brazilian.

Cernunos

  • Sergeant at Arms
  • *
  • A 1000 miles trekk starts with a first step.
    • View Profile
  • Faction: Nord
Re: Simplified KeyConfig Presentation (OSP)
« Reply #9 on: April 29, 2011, 10:39:27 PM »
Hmmm, Ikaguia, may I kiss you  :?:  :oops:  :mrgreen:

Thanks a lot, at least ^^

Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #10 on: April 29, 2011, 10:45:59 PM »
Hmmm, Ikaguia, may I kiss you  :?:  :oops:  :mrgreen:

Thanks a lot, at least ^^
:x :x :?: :?: :?:

that hapened with me a lot, but i think it stopped happening when i started using notepad++


Sorry for my poor English, I'm Brazilian.

Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #11 on: June 13, 2011, 10:26:14 PM »
(click to show/hide)
« Last Edit: June 15, 2011, 07:47:50 PM by Ikaguia »


Sorry for my poor English, I'm Brazilian.

dunde

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
Re: Simplified KeyConfig Presentation (OSP)
« Reply #12 on: June 15, 2011, 01:35:21 AM »
we don't need to. Adding
( c a l l _ s c r i p t , " s c r i p t _ i n i t _ a l l _ k e y s "),
at game_start script did the initialization we need already.

Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Simplified KeyConfig Presentation (OSP)
« Reply #13 on: June 15, 2011, 07:08:52 PM »
oh thanks

also, how do I get the name of a key?

exmaple:
my mission template is like this:
(click to show/hide)
I've made all that keys customizable using this kit but I want my code to show the correct keys.

edit:
would it be something like this?
(click to show/hide)
« Last Edit: June 15, 2011, 07:48:22 PM by Ikaguia »


Sorry for my poor English, I'm Brazilian.

dunde

  • Grandmaster Knight
  • *
  • Curious Coder of The Vision
    • View Profile
  • Faction: Swadian
  • WB
Re: Simplified KeyConfig Presentation (OSP)
« Reply #14 on: June 15, 2011, 11:25:29 PM »
To make the presentation display correct name of the keys, you should modify this part of module_strings.py:
Code: [Select]
# K E Y F u n c t i o n A s s i g nme n t L a b e l
# - - P a r t s t o mo d i f y a s y o u r mo d n e e d - - - - - - - - - - - - - -
 ( " k e y _ n o 1 " , " T o g g l e C ame r a Mo d e " ) ,
 ( " k e y _ n o 2 " , " N e x t B O T " ) ,
 ( " k e y _ n o 3 " , " P r e v B O T " ) ,
 ( " k e y _ n o 4 " , " C ame r a Z o om I n " ) ,
 ( " k e y _ n o 5 " , " C ame r a Z o om O u t " ) ,
 ( " k e y _ n o 6 " , " C ame r a T u r n U p " ) ,
 ( " k e y _ n o 7 " , " C ame r a T u r n D own " ) ,
 ( " k e y _ n o 8 " , " C ame r a T u r n R i g h t " ) ,
 ( " k e y _ n o 9 " , " C ame r a T u r n L e f t " ) ,
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
edit:
i don't know why my code above have extra space after each char. Please ignore it and refers to the starter post. i'm sorry for this, I write this post from my mobile device.
« Last Edit: June 15, 2011, 11:38:19 PM by dunde »