Tux Posted February 20, 2023 Share Posted February 20, 2023 Frequency in a random number ?! Sounds odd to say the least, I'll take a look later... ! Link to comment Share on other sites More sharing options...
ffman1985 Posted February 20, 2023 Author Share Posted February 20, 2023 The result is more obvious in training mode during character select. Link to comment Share on other sites More sharing options...
Tux Posted February 20, 2023 Share Posted February 20, 2023 28 minutes ago, ffman1985 said: The result is more obvious in training mode during character select. Well I tested, and I am not really convinced, you see the effect of rnd(), the %Misc varies now, but it's not really faster... I return to the normal script for now... (I prefer stable numbers which can be read easily, and the numbers are < 10% even in debug mode here, so it's not worth something like that). Link to comment Share on other sites More sharing options...
ffman1985 Posted February 20, 2023 Author Share Posted February 20, 2023 It can help to reduce the misc % in my beginning test. However, when I try again without power supply plug into my laptop, the misc % is very high. I donāt know why. Link to comment Share on other sites More sharing options...
Tux Posted February 20, 2023 Share Posted February 20, 2023 36 minutes ago, ffman1985 said: It can help to reduce the misc % in my beginning test. However, when I try again without power supply plug into my laptop, the misc % is very high. I donāt know why. I guess without power supply your frequency is lowered to save power, and everything slows down, all easily. Tower here, so stable, but running by default Ć 1.5 Ghz, the frequency increases only if the cpu load average increases, and raine stays very low on the low average usually, even with your script running it stays at 1.5 GHz. Link to comment Share on other sites More sharing options...
ffman1985 Posted April 17, 2023 Author Share Posted April 17, 2023 Hello Tux, I need some help on the script function. I am trying a script to poke values into multipy addresses with regular interval: that is, $90C090, $90C094, 90C098... $90C338, each with a interval of $04. The game I perform the test is Marvel Super Heroes (mshud.zip). The objective is to remove the backgound object on the title screen (theĀ gauntlet). Here is my script: (just focus on the if-endif part, the script is enabled on the title screen) script "test" run: #Shift background# poke $FF4BE1 $F3 poke $FF26AD $71 #Remove gauntlet# if dpeek($FF1020)<=$02AC Ā Ā dpoke $90C090+dpeek($FF1020) $6000 Ā Ā dpoke $FF1020 dpeek($FF1020)+$0004 endif Ā Although it can remove the background, it is super inefficient. (The gauntlet is removed slowly). Then I try to add a variable for $FF1020 (which I use for the purpose of a counter), but the game alway crash. (The following two tests) script "test 2" run: poke $FF4BE1 $F3 poke $FF26AD $71 counter=dpeek($FF1020) if counter<=$02AC Ā Ā dpoke $90C090+counter $6000 Ā Ā dpoke counter counter+$0004 endif Ā script "test 3" run: mode=peek($FF1000) Ā Please advise. Thank you for your kind attention. Link to comment Share on other sites More sharing options...
Tux Posted April 17, 2023 Share Posted April 17, 2023 There are 2 parts here : 1) it's not a crash, it's the effect of the recent optimization to make the ifs faster, if you run raine from a console (which is always the case for me in linux, curse windows to make running programs from a console so difficult !), you'll see it prints an error message before exiting without crashing, the message says : no command for counter=dpeek($FF1020) It's not an error from you, it's because the optimization expects to have real commands inside an if, that is a function name and then some parameters, which is not the case here, something I forgot but I thought we would have found this kind of case earlier. Anyway its really easy to fix, I just pushed the fix in git. The script doesn't remove the gauntlet, it keeps the gauntlet alone on the title screen 2) what you really need here is a loop, simply. Well the fact is that these scripts were never meant to be that complex so the notion of block is not really defined for them for now except for the if..elsif|else...endif case. What I could do is a simplified loop without block, like the c for loop, but without block which would look like : for init test increment instruction where init would be the initalization of the loop variable, like i=0 test would be the test to run for each turn like i<=12 increment would be what is executed at the end of the loop, like i=i+4 (the i+=4 from C is not supported by the console !) and finally instruction the optional instruction to run inside the loop, which would replace a whole block, like dpoke adr+i value This would be a good compromise, not too hard to do, and it would simplify quite a lot this kind of problem, plus the loop would execute in 1 frame, here your script runs a lot of frames for its loop. What do you think ? Link to comment Share on other sites More sharing options...
Tux Posted April 17, 2023 Share Posted April 17, 2023 Just pushed this simple for loop to git, your script becomes : script "test 2" on: Ā Ā poke $FF4BE1 $F3 Ā Ā poke $FF26AD $71 Ā Ā for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000 it's now a on: script, not a run: because everything executes in just 1 frame. Link to comment Share on other sites More sharing options...
ffman1985 Posted April 17, 2023 Author Share Posted April 17, 2023 Updated in git and have copied and pasted the script to my txt file, but it doesn't work. Also, since it is now become on instead of run, is that means it cannot be part of my console mode script which is run? Link to comment Share on other sites More sharing options...
Tux Posted April 17, 2023 Share Posted April 17, 2023 (edited) Well it works here so you probably made a mistake somewhere. Of course not you can do whatever you want with it, but be careful if the loop never ends then raine will freeze and the only way to stop it will be to kill it (from the task manager). You can open the console and do a help for to check if for is really inside. And of course if you run a loop such as the one in your example in every frame in a run: script, it will probably be very very slow ! Edited April 17, 2023 by Tux Link to comment Share on other sites More sharing options...
ffman1985 Posted April 18, 2023 Author Share Posted April 18, 2023 I just copy and paste the script you provided above. I can execute the script without warning (so it proves that my Raine is updated through git, unlike that there is warning in the old version). However, it seems that the for loop part of the script does not work. After executed, theĀ gauntlet remains on the screen. Then I use the peek function in the console to test the adress $90C090, $90C094..., and it shows that their value are not changed. 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