piotre_94 Posted September 1, 2009 Share Posted September 1, 2009 Hi! I'm wondering if it's possible to get the value of a local variable from the main.scm with a cleo mod? in the main.scm I've got this varible [email protected] in mission X and want to check its value for my cleo mod i think it's impossible, but i can't find an another solution Link to comment Share on other sites More sharing options...
TheSiggi Posted September 1, 2009 Share Posted September 1, 2009 [...The difference between local and global variable is that you use a global through the whole script. A local variable is applies only within one thread. When you assign a value to [email protected], and you want to use that number in another thread again, it won't be avaiable, you have to assign it that value again. The value of the other thread doesn't apply any more.[...] But I think you can define the thing (which is defined as [email protected] in mission x) in your script....depends on what [email protected] is Link to comment Share on other sites More sharing options...
Wesser Posted September 1, 2009 Share Posted September 1, 2009 As I know, you can't get any values from a local variable if it's not placed in the current "thread". Use global vars instead. 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
TheSiggi Posted September 1, 2009 Share Posted September 1, 2009 As I know, you can't get any values from a local variable if it's not placed in the current "thread". Use global vars instead. I think he/she wants to handle an object which appears in mission x.....that could be anything....a barrel or an ammo box so it depends on what [email protected] means: if [email protected] is an object than he/she jaus has to load and define it Link to comment Share on other sites More sharing options...
piotre_94 Posted September 1, 2009 Author Share Posted September 1, 2009 actually [email protected] is a varible used in the mission learing fly its the number of exercice you choose [email protected]=1 -> you're trying to do parachute jump [email protected]=2 -> you're trying to landing with a hunter etc i make a trainer for drive skool with cleo Link to comment Share on other sites More sharing options...
TheSiggi Posted September 1, 2009 Share Posted September 1, 2009 (edited) Well then there should be a definition of [email protected] in the beginning of the thread something like: [...] handle as [email protected] or [email protected] = [...] so just search for them and find the opcode and your done EDIT:// I looked for the opcode and found this: :DESERT5_272600D6: if 0039: [email protected] == 5 004D: jump_if_false @DESERT5_2751 0006: [email protected] = 6 [email protected] is only a counter which is designed as an other term.... I guess you want to give CJ a parachute when exiting a plnae/heli? Just like if you had passed the Learning to fly mission and got your pilot license, right?? 0004: $FREEFALL_STAGE = 0 0004: $PARACHUTE_CREATION_STAGE = 0 062A: change_stat 223 (pilot skill) to 1000.0; float a few codes I found which might do the same....or you just write a simple script like: 03A4: name_thread 'CLTRNR1' :CHUTE_01 wait 0 if and 0491: actor $PLAYER_ACTOR has_weapon 46 0256: player $PLAYER_CHAR defined 03EE: player $PLAYER_CHAR controllable 04AB: actor $PLAYER_ACTOR driving_plane 04A9: actor $PLAYER_ACTOR driving_heli 00E1: key_pressed 0 18 // horn jf @CHUTE_01 wait 0 0247: load_model #GUN_PARA 01B2: give_actor $PLAYER_ACTOR weapon 46 ammo 1 // Load the weapon model before using this 0249: release_model #GUN_PARA 038B: load_requested_models jump @CHUTE_01 thtas just a quick one.... Edited September 1, 2009 by The_Siggi Link to comment Share on other sites More sharing options...
OrionSR Posted September 1, 2009 Share Posted September 1, 2009 See if this script works reliably enough. I don't understand what's going on in memory here but it seemed to work consistently during testing. {$CLEO .cs}0000:while true wait 250 if 0AB0: key_pressed 0x76 // F7 then 0006: [email protected] = 34 // local variable number to read 0012: [email protected] *= 4 // variable length 000A: [email protected] += 0xA48960 // start of (unknown) variable space 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 01E3: show_text_1number_styled GXT 'NUMBER' number [email protected] time 5000 style 1 endend Link to comment Share on other sites More sharing options...
piotre_94 Posted September 3, 2009 Author Share Posted September 3, 2009 it works perfectly . Thank you so much I have just one question about your technic, is it possible to "injected" an another value into a local variable in the main.scm? for example: in the main.scm i've got [email protected] = 42 could we change it like this [email protected] = [email protected] ([email protected] is a local value of my cleo mod) Link to comment Share on other sites More sharing options...
Deji Posted September 3, 2009 Share Posted September 3, 2009 Mmm... Don't think so... But remember, with memory access nearly everything that is already in the game is possible So you just need to get the memoy of that variable. I think there's a program by Seemann that allows you to view/edit local variables while the game is on. Get that program, go on the mission and see what the value is... Then, using CheatEngine (or something similar) scan for that value... If there are a few results, play the mission a bit and see if the value changes. If so, do another scan Once you find the address, you can edit it in your CLEO script... I call proccesses like this "Script Hijacking" since it requires you to force interaction between 2 scripts. I used it in the Black Market mod to change the actions of all drug dealers Not sure if that's the best way of going about it, but it's what I'd try... I'm sure another modder will click the quote button or something and correct me somehow Link to comment Share on other sites More sharing options...
piotre_94 Posted September 3, 2009 Author Share Posted September 3, 2009 Mmm... Don't think so... But remember, with memory access nearly everything that is already in the game is possible biggrin.gif So you just need to get the memoy of that variable. I think there's a program by Seemann that allows you to view/edit local variables while the game is on. Get that program, go on the mission and see what the value is... Then, using CheatEngine (or something similar) scan for that value... If there are a few results, play the mission a bit and see if the value changes. If so, do another scan wink.gif Once you find the address, you can edit it in your CLEO script... I call proccesses like this "Script Hijacking" since it requires you to force interaction between 2 scripts. I used it in the Black Market mod to change the actions of all drug dealers smile.gif Not sure if that's the best way of going about it, but it's what I'd try... I'm sure another modder will click the quote button or something and correct me somehow tounge2.gif I find the program by seamann but i don't know how to instal it can someone help me please Link to comment Share on other sites More sharing options...
OrionSR Posted September 3, 2009 Share Posted September 3, 2009 I have just one question about your technic, is it possible to "injected" an another value into a local variable in the main.scm? Maybe. For starters, as I mentioned before, I'm not at all sure what's going on in memory here. Also, I've got no idea how the standard "mission" will react to having it's variables changed while it's running. The results may not be as expected. I suppose it's worth a try. Driving School is a mission. Missions have many more local variables available than scripts. Usually only 1 mission is running at a time, although it is possible for more than one mission to be active. The memory region I was accessing appears to be used by whichever mission is running first. I was unable to find where a custom CLEO mission that was launched after starting driving school was storing it's variables. In the few tests I conducted the mission always used the same memory region for it's local variables, but I've got no idea if that will always be the case. Clarification: main.scm is the filename of the script. MAIN is the name of the thread that controls all the action and I suspect it has it's own set of local variables. You mentioned that you were making a trainer for driving school (DSKOOL). So, if I understand correctly, you want to "inject" values into the local variables of dskool. You should probably add a check to make sure that the thread you want to mess with is actually running before altering any information in memory. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now