Page 2 of 2

Re: Script manipulation does nothing

Posted: Sat Dec 02, 2017 6:12 am
by WhoElseButMe
FormatText was added in thps4 I believe, sorry about that.
You'll need to look for something in the scripts that does some form of formatting and try and duplicate it
I swear I saw something in a script using %s0 and %s1 for variables of skater names.
and for newer game the player's score is scorepot might not be the same in thps3.
if scorepot > 1000
//do something
endif
You could try running dbgview before running the game and see if it captures the printf but i'm fairly certain they don't compile the game with the printf function in the exe or only have it return without doing anything.

Re: Script manipulation does nothing

Posted: Mon Dec 04, 2017 3:19 pm
by benne
Bad new.. maybe worst news ever

It seems that THPS3 not even supports the comperative operators "<" and ">" :(
this is what I tried:

Code: Select all

:u(02:00000001)$value1$ = %i(1,00000001)
:u(02:00000001)$value2$ = %i(2,00000002)
:u(02:00000001)function $SkateInOrBail$
   
   :u(02:00000006)doIf ($value1$ < $value2$)
      :u(02:00000006)call $SendChatMessage$ arguments
      $string$ = %s(4,"haha")
   :u(02:00000006)endif


It compiles correctly, but nothing happens when I try to bail. It doesn't matter if I swap the values etc...

anything I'm doing wrong here?

and a second thing concerning the player score:

Code: Select all

 :u(02:0000008d)function $display_score_1$
   12:    :u(02:0000008f)$launchpanelmessage$%s(15,"1 %s0 |  &c1%s1")$s0$ = %GLOBAL%call $String0$ arguments
   13        $s1$ = %GLOBAL%$String1$$properties$ = $score_display1$

But "String0" and "String1" are nowhere defined and just calling the functions does nothing except printing "1 %s0 | &c1%s1" so it does not seem to work either :(

Re: Script manipulation does nothing

Posted: Mon Dec 04, 2017 7:53 pm
by Morten1337
I think something like this can work:

Code: Select all

:u(02:00000000)function $benne_test_function$
   :u(02:00000000)$score_1$ = %i(10000,)
   :u(02:00000000)$score_1$ = %i(20000,)
   :u(02:00000000)$LaunchPanelMessage$%s(,"1 %s0 | &c1%s1") $s0$ = %GLOBAL%$score_1$ $s1$ = %GLOBAL%$score_1$ $properties$ = $score_display1$
:u(02:00000000)endfunction

I also think you can call the "display_score_1" function like this:

Code: Select all

#// ...
:u(02:00000000)$display_score_1$ $String0$ = %i(0,) $String1$ = %i(20000,)
#// ...


If that dosnt work, i think you can also format strings by doing something like this:

Code: Select all

#// ...
:u(02:00000000)$score_1$ = %i(10000,)
:u(02:00000000)$score_2$ = %i(20000,)
:u(02:00000000)$myString$ = (%s(,"Score: ") + %GLOBAL%$score_1$ + %s(," | ") + %s(,"Score2: ") + %GLOBAL%$score_2$ + %s(," | "))
:u(02:00000000)$LaunchPanelMessage$ %GLOBAL%$myString$
#// ...

Re: Script manipulation does nothing

Posted: Tue Dec 05, 2017 6:35 pm
by benne
thanks for your help, man, but I'm afraid none of your suggestions work :(
tried all of them, always crashes the game.
btw it also crashes the game if I just declare a variable INSIDE of a function. Outside it works. So I changed all variables to global ones in your suggestions, but that also does not work

its kinda frustrating because I already spent so many hour in this and didnt accomplish anything. Is there even somebody modding THPS3 here?

I'm starting to ask myself, is SOMETHING works in THPS3-scripting o.O
no local variables
no printing of integers of floats / formatted strings
no > and <
and no scorepot (but I guess I could find it, if I had a way to print out Integers..)

:(

Re: Script manipulation does nothing

Posted: Wed Dec 06, 2017 12:11 am
by Demo
well there were good examples of thps3 script mods like ksk's thps3 1.3 and coolsnake's levelout.
th3 was the earliest qb scripting iteration, it's limited and you can't expect stuff from later games to work here.
a lot of stuff is hardcoded in the executable and you can't do anything about it.
iirc there is SkaterTotalScoreGreaterThan function that you can use like this:

Code: Select all

 IF SkaterTotalScoreGreaterThan 1000
   <do stuff>
 END IF

i don't think there are any built-in string manipulation functions.
you can't even use basic math functions in a normal way (like smth = 2 + 2). for example, this is how they count goal objects (from foun.qb):

Code: Select all

#01186  VAR_GROMMET_COUNTER = 0

<...>

#01244    IF Obj_VarEQ var = VAR_GROMMET_COUNTER  value = 1
#01245      LaunchPanelMessage "1 of 5 Skaters Impressed"
#01247    ELSE
#01249      IF Obj_VarEQ var = VAR_GROMMET_COUNTER value = 2
#01250        LaunchPanelMessage "2 of 5 Skaters Impressed"
#01252      ELSE

<...>

basically
if counter = 1 then launch message1
else if counter = 2 then launch message2
etc

there are more Obj_Var prefixed functions including
Obj_VarAdd for addition
Obj_VarSub for subtraction
Obj_VarInc for ++
Obj_VarDec for --

for a full list of available functions you can open Skate3.exe (version 1.01) in a hex editor and jump to 0x1B8868

Re: Script manipulation does nothing

Posted: Wed Dec 06, 2017 11:36 am
by benne
Ohhh myy good :D
Demo, you're a lifesaver! Thank you so much that was exactly the information I was looking for. Now at least I got something to work with. I'm scanning the functions inside the exe right now and look for clues. Just 2 things left until I got everything I need:
1. get the player score (not compare it with something but get the exact value)
2. print a number on the screen

but I hope with some hours of try&error I will be able to find that. (but if you happen to know it, pls tell me :) )

btw: I'm doing something similar like post_exodus... he is trying do implement a score cap in Horse mode (see other thread).. we are working together now ;)