Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Read only key error, Key config problem #166784
11/10/07 03:04
11/10/07 03:04
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
Hello everyone, I'm not the best coder out there, but I can usually figure out what the problem is and fix it. I've looked everywhere in the manual, and looked through all of my code.

I'll explain a bit of the situation I'm in, Using updated A5 code on the latest A6 engine build. Never wanted to update to the new template scripts considering I've had everything working the way I wanted it to. I decided to finally update and port everything over and updated everything to work in the latest engine update except for my key configuration wdl.

I'm using the key config script from the AU resource site. It worked fine all the way through a6.3 (where I was) and now refuses to work in a6.6.

This is the section giving me problems.


Code:
 my_key_up=get_key(up_key_var);
my_key_down=get_key(down_key_var);
my_key_left=get_key(left_key_var);
my_key_right=get_key(right_key_var);
my_key_run=get_key(run_key_var);
my_key_jump=get_key(jump_key_var);
my_key_crouch=get_key(crouch_key_var);
my_key_roll=get_key(roll_key_var);
my_key_lookup=get_key(lookup_key_var);
my_key_lookdown=get_key(lookdown_key_var);
my_key_strafel=get_key(strafel_key_var);
my_key_strafer=get_key(strafer_key_var);




Everything is defined correctly as far as I know.

I keep getting read only errors. Something like key_cuu read only. I would really appreciate any help, I've been stuck on this for a few days. Thanks in advance.


Re: Read only key error, Key config problem [Re: Havoc22] #166785
11/10/07 09:35
11/10/07 09:35
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
You assinged something to key_cuu, with a function or directly with an assing (=).
Maybe you wrote something like that: key_cuu = 1; or key_cuu = get_key(34);
Just use the search function of SED an search for key_cuu. Than look if you wrote something like above. If not, post the line where key_cuu turns up.

Dark_Samurai


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: Read only key error, Key config problem [Re: Dark_samurai] #166786
11/10/07 14:56
11/10/07 14:56
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
function define ()
{
if(key_cud==1)
{
new_key_str="DOWN";
return(80);
}

function get_key(get_var)
{
if(key_var==72)
{
return(key_cuu);
}
}


define my_key_up,key_cuu;
var_info up_key_var=17;

These are the only three instances where key_cuu is used throughout the script.

As far as I can tell, none of them have =, just ==. Thank you for helping me so far though.

Re: Read only key error, Key config problem [Re: Havoc22] #166787
11/10/07 16:30
11/10/07 16:30
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
i see u got it, i dont know sure whate youre doing but maby this helps you
key_pressed(//scancode);


"empty"
Re: Read only key error, Key config problem [Re: flits] #166788
11/10/07 16:58
11/10/07 16:58
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Just for testing reasons, comment the return(key_cuu);. I'm not sure if this is allowed (although I don't know why it shouldn't). Just look if the message still turns up.

[edit:] Now I know whats the problem! You define: define my_key_up, key_cuu; and then you write my_key_up = get_key(up_key_var);. This line is the same as if you write key_cuu = get_key(up_key_var);!!!

PS:I'm not totally sure if it's realy like i mentioned, but I think I'm right^^

Dark_Samurai

Last edited by Dark_samurai; 11/10/07 17:03.
Re: Read only key error, Key config problem [Re: Dark_samurai] #166789
11/11/07 01:33
11/11/07 01:33
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
Yeah I kind of figured that somehow through all the defining of everything in the script that key_cuu was set to = a variable somewhere. Now that I know where the problem is, I still can't seem to come up with a solution as to how to fix that.

If I comment out sections that give problems, I get zero script errors. However, it doesn't do anything. I can redefine all of my other keys, just not those ones mentioned above. key_cuu, key_cud and all of those.

Thanks again, you've been a great help so far.

Any clues as to whether or not something changed with the key mapping between engine updates? It worked fine on earlier a6 versions. I looked in the manual and couldn't find anything about changes in the key mapping process.

Re: Read only key error, Key config problem [Re: Havoc22] #166790
11/12/07 01:52
11/12/07 01:52
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
Any one have any ideas how to fix this? I'm still a little stuck.

I just don't get how I could define it like that in previous A6 versions and not the new one. It worked just fine before.

Re: Read only key error, Key config problem [Re: Havoc22] #166791
11/13/07 02:47
11/13/07 02:47
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
How am I supposed to redefine the keys if they are read only? It worked before, this is becomming a pain.

Re: Read only key error, Key config problem [Re: Havoc22] #166792
11/13/07 07:21
11/13/07 07:21
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Code:
define my_key_up, key_cuu;


Potentially:
my_key_up is 'defined', it is a constant and it can not be reassigned?
Technically, my_key_up is not key_cuu exactly, it is instead the static value of key_cuu?

So we can assume this will not work, because a 'define', a constant is being reassigned.
Code:
my_key_up=get_key(up_key_var);


(That was sort of stated already by another user, I think.)

As is often the case, the compiler can a give a somewhat confusing, bullsh!tty response, but such a response is usually related to the problem in some way.
I believe the compiler refers to the incorrect reassignment of 'constant definition' my_key_up, as 'read-only key_cuu'.
Perhaps the compiler should instead state: "Hey slick, my_key_up is a constant definition. It's value cannot be reassigned during runtime. Use a var instead?"
Maybe try:
Code:

// I assume what follows is supposed to be a default setting.
var my_key_up = key_cuu;
// or
var my_key_up = (numerical value of key_cuu in manual);


Then reassignment of my_key_up should work, I think.
Code:
my_key_up=get_key(up_key_var);



Sort of a guess, I guess.

Re: Read only key error, Key config problem [Re: testDummy] #166793
11/13/07 18:59
11/13/07 18:59
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline OP
Junior Member
Havoc22  Offline OP
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
Wow, that actually works. Thanks for all of the help everyone. I just got rid of the define sections and replaced my_key_up as a variable just like you said and it worked perfectly. Thanks again.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1