home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Editing control

by Bibi on 11/04/2010 18:57, 19 messages, last message: 11/10/2010 18:36, 2112 views, last view: 04/15/2024 23:55

Editing control can't be configured in UI, and are badly maped for azerty keyboard (undo is maped on forward, strafe left is fucked up too). I dont really care because i'm under linux, and all it's cost is 2 or 3 clicks to swap keyboard layouts, but it could be annoying for some other french.

   Board Index   

#1: ..

by eihrul on 11/04/2010 19:53

See data/keymap.cfg

reply to this message

#2: ..

by SheeEttin on 11/04/2010 19:57

http://sauerbraten.org/docs/config.html#bind

http://cube2.fhnet.fr/

reply to this message

#3: ..

by Osbios on 11/04/2010 21:23

The best way to configure you keyboard for editing is to create a autoexec.cfg file in your sauerbraten directory. (or on unix like systems "~/.sauerbraten" if I remember correctly)

There you can do thinks like this

bind "Z" [sayteamcommand]
editbind "Z" [notepad (mapcfgname)]
specbind "Z" [say please unspec me :(]


And very usefull are switching keys. Like disable or enable a setting for example fullbright:

EDIT_FULLBRIGHT = 0
fullbright 0
editbind "F7" [ if (= $EDIT_FULLBRIGHT 0) [fullbright 1; EDIT_FULLBRIGHT = 1; echo fullbright 1] [fullbright 0; EDIT_FULLBRIGHT = 0; echo fullbright 0] ]

reply to this message

#4: fail

by Razgriz on 11/05/2010 07:13, refers to #3

editbind F7 [fullbright (= $fullbright); echo fullbright is (? (= $fullbright) off on)]

you better avoid coding :P

reply to this message

#5: ..

by Osbios on 11/05/2010 12:20

Sure that is more elegant.

But I use my methode because I remember that you couldn't read some "game" variables with the $.

reply to this message

#6: Re: ..

by Razgriz on 11/05/2010 16:06, refers to #5

these you speak of are few. colors for example need to undergo some special decoding before it can be used. skylight 255 255 255 for example is 16777215, but i have no idea what that is, and perhaps eihrul would care to explain how we can use that.

reply to this message

#7: ..

by Atomizer on 11/05/2010 17:07

The color is saved to a single integer using bitshifting or something to that effect. The simplest (?) way to decode the color manually is to copy the integer value (16777215) to a calculator and switch to from decimal to hexadecimal mode, then you\'ll see \"FFFFFF\" where two hexes are used for red, green and blue respectively ranging from 00 (0) to FF (255).

reply to this message

#8: HEX values

by MeatROme on 11/05/2010 18:43

or just enter 0xFFFF00 for a yellow, 0x00FF00 for a green .. etc. pp. - the format is 0xRRGGBB with RR, GG, and BB being the channels or RED, GREEN, and BLUE respectively.
HTH

BTW: before eihrul implemented this form of input I wrote a little CubeScript to combine the channels to a single integer.

reply to this message

#9: Re: HEX values

by Razgriz on 11/05/2010 21:25, refers to #8

yea, i know about hex, but currently this bitshifted format is of little use without proper decoding. hirato gave me some code i could use, but i think i'll have quite the trouble before i bring it together. unless someone has a premade script i could use.

reply to this message

#10: Re: fail

by SheeEttin on 11/06/2010 04:54, refers to #4

/editbindvar F7 fullbright
:P

Re hex variables:
I have no idea what you mean by "decoding". Everything that takes an integer as a color accepts hex (and displays it, too).

reply to this message

#11: Re: fail

by Razgriz on 11/06/2010 08:56, refers to #10

first of all i hate that *bindvar.

second, i wasn't talking about hex that needs decoding. if you do $skylight from a value of 255 255 255 it returns 16777215 which is some sort of bitshifted format that is pretty much unusable in its current state since it doesn't make sense.

reply to this message

#12: Re: fail

by MeatROme on 11/09/2010 19:59, refers to #11

uhm .. bitshifted??
This works fine (PHP code):
$iv = 16777215;
$B = $iv & 0x0000FF;
$G = ($iv & 0x00FF00) / 0x000100;
$R = ($iv & 0xFF0000) / 0x010000;
echo sprintf( "R: %d | G: %d | B: %d", $R, $G, $B );

http://quadropolis.us/node/908 was where I posted the conversion code .. your OS should have a calculator application, just switch it to scientific mode to transform values between schemes.

reply to this message

#13: Re: fail

by Razgriz on 11/09/2010 23:13, refers to #12

3 people have told me about the calculator already, i wonder how many more "captain obvious" signs i have to raise to aid the fact that i want to decode that thing IN SAUER and not from an external application dot

reply to this message

#14: Re: fail

by SheeEttin on 11/09/2010 23:32, refers to #13

Write some code so HVAR*s get printed in hex when accessed by (e.g.) $skylight. I'm sure eihrul would be happy to accept a patch. :P

Or, just write a quick function to convert any integer to hex.

reply to this message

#15: Re: fail

by Razgriz on 11/10/2010 00:19, refers to #14

yea, if only i knew how to decode it to hex or rgb, which is the point of this discussion we've been looping around for so long >_>

reply to this message

#16: Re: fail

by SheeEttin on 11/10/2010 00:34, refers to #15

printf("%X", number);

conoutf() should accept the same.

reply to this message

#17: Re: fail

by Razgriz on 11/10/2010 13:12, refers to #16

ok, i give up. i have to point every single thing and explain it times and times over, just screw the whole thing for a couple of months or so when i'll "maybe" remember it again.

@SheeEttin. no. not cpp. CUBESCRIPT! its a language where easy things get harder and hard things may seems unexplainably easy >_>

reply to this message

#18: Re: fail

by MeatROme on 11/10/2010 18:34, refers to #17

*sigh* .. the PHP code could be translated easily into CubeScript:
int2hex = [
echo got $arg1
R = (div (& $arg1 0xFF0000) 0x010000)
G = (div (& $arg1 0x00FF00) 0x000100)
B = (div (& $arg1 0x0000FF) 0x000001)
echo R: $R G: $G B: $B
]

test_int2hex = [
int2hex (+ 0xFF00FF 0)
int2hex (+ 0x123456 0)
int2hex 423098
]

reply to this message

#19: Re: fail

by MeatROme on 11/10/2010 18:36, refers to #18

Quite apart from that - my sauerbraten outputs an INT and per-channel-values for stuff like skylight.

reply to this message

   Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53873562 visitors requested 71648786 pages
page created in 0.019 seconds using 10 queries
hosted by Boost Digital