Upvote Upvoted 0 Downvote Downvoted
Multi-variable command manipulation
posted in Customization
1
#1
0 Frags +

Hey guys, I have this idea for a script that would simplify my life a lot, but I just can't come up with a reasonable way to pull it off.
Basically I am a viewmodel modder, where I reposition the viewmodels to a place where they take up less screen space. A command I use a lot for this is "tf_viewmodels_offset_override x y z", it moves the viewmodels around so that I can see what position feels nicer to then make it usable in pubs (this command is sv_cheats 1 restricted but I have a way of moving the viewmodels without it, I just need an estimate where I should move it since it involves a lot of game restarts). I recently had an idea of binding it to some keys like arrows and plus/minus to move the viewmodel around for my convenience, because typing it in manually is a tedious process, but the most obvious way, incrementvar, doesn't seem to work on multi-variable commands. The only way of pulling it off I can come up with is using incrementvar to move along the x axis (because that's what's changing when it's being used with the command) and a system of aliases for each possible position I would need that binds the keys to moving it to the nearby slot, but that's too many aliases (like, 1600 too many). Is there any other solution I am missing, perhaps a command or an addition to incrementvar to make it change other values of tf_viewmodels_offset_override?

Hey guys, I have this idea for a script that would simplify my life a lot, but I just can't come up with a reasonable way to pull it off.
Basically I am a viewmodel modder, where I reposition the viewmodels to a place where they take up less screen space. A command I use a lot for this is "tf_viewmodels_offset_override x y z", it moves the viewmodels around so that I can see what position feels nicer to then make it usable in pubs (this command is sv_cheats 1 restricted but I have a way of moving the viewmodels without it, I just need an estimate where I should move it since it involves a lot of game restarts). I recently had an idea of binding it to some keys like arrows and plus/minus to move the viewmodel around for my convenience, because typing it in manually is a tedious process, but the most obvious way, incrementvar, doesn't seem to work on multi-variable commands. The only way of pulling it off I can come up with is using incrementvar to move along the x axis (because that's what's changing when it's being used with the command) and a system of aliases for each possible position I would need that binds the keys to moving it to the nearby slot, but that's too many aliases (like, 1600 too many). Is there any other solution I am missing, perhaps a command or an addition to incrementvar to make it change other values of tf_viewmodels_offset_override?
2
#2
1 Frags +

not possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really) and navigating through them with other aliases bound to arrowkeys/+/-. it's possible in csgo because the viewmodel offsets are split to viewmodel_offset_x, viewmodel_offset_y and viewmodel_offset_z but then you only have a small border that you can move along

not possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really) and navigating through them with other aliases bound to arrowkeys/+/-. it's possible in csgo because the viewmodel offsets are split to viewmodel_offset_x, viewmodel_offset_y and viewmodel_offset_z but then you only have a small border that you can move along
3
#3
1 Frags +

You can probably do "incrementvar tf_viewmodels_offset_override x 0 150 10"

Which will increase tf_viewmodels_offset_override x by ten to a maximum of 150, at which point it will go back to 0.

You can probably do "incrementvar tf_viewmodels_offset_override x 0 150 10"

Which will increase tf_viewmodels_offset_override x by ten to a maximum of 150, at which point it will go back to 0.
4
#4
0 Frags +
quintoshnot possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really)

quick python script for this:

# range to set
min = -2
max = 2

# enforce proper wrapping rules
def getCoords(x, y, z, separator):
    toret = ''
    toret += str((x - min) % (max - min + 1) + min) + separator
    toret += str((y - min) % (max - min + 1) + min) + separator
    toret += str((z - min) % (max - min + 1) + min) 
    return toret

# base binds
for c in ['x', 'y', 'z']:
    print('alias "inc_vm_' + c + '" "vm_0_0_0"')
print('')

# internal state binds
for x in range(min, max + 1):
    for y in range(min, max + 1):
        for z in range(min, max + 1):
            toprint = 'alias "vm_' + getCoords(x, y, z, '_') + '" "'
            toprint += 'tf_viewmodels_offset_override ' + getCoords(x, y, z, ' ') + ';'
            toprint += 'alias inc_vm_x vm_' + getCoords(x+1, y, z, '_') + ';'
            toprint += 'alias inc_vm_y vm_' + getCoords(x, y+1, z, '_') + ';'
            toprint += 'alias inc_vm_z vm_' + getCoords(x, y, z+1, '_') + '"'
            print(toprint)

There's some obvious big improvements (support for decrementing instead of just having to wrap around, and support for floats / not having to always be an integer) but this should get the idea across.

[quote=quintosh]not possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really)[/quote]
quick python script for this:
[code]# range to set
min = -2
max = 2

# enforce proper wrapping rules
def getCoords(x, y, z, separator):
toret = ''
toret += str((x - min) % (max - min + 1) + min) + separator
toret += str((y - min) % (max - min + 1) + min) + separator
toret += str((z - min) % (max - min + 1) + min)
return toret

# base binds
for c in ['x', 'y', 'z']:
print('alias "inc_vm_' + c + '" "vm_0_0_0"')
print('')

# internal state binds
for x in range(min, max + 1):
for y in range(min, max + 1):
for z in range(min, max + 1):
toprint = 'alias "vm_' + getCoords(x, y, z, '_') + '" "'
toprint += 'tf_viewmodels_offset_override ' + getCoords(x, y, z, ' ') + ';'
toprint += 'alias inc_vm_x vm_' + getCoords(x+1, y, z, '_') + ';'
toprint += 'alias inc_vm_y vm_' + getCoords(x, y+1, z, '_') + ';'
toprint += 'alias inc_vm_z vm_' + getCoords(x, y, z+1, '_') + '"'
print(toprint)
[/code]There's some obvious big improvements (support for decrementing instead of just having to wrap around, and support for floats / not having to always be an integer) but this should get the idea across.
5
#5
0 Frags +
_KermitYou can probably do "incrementvar tf_viewmodels_offset_override x 0 150 10"

The "incrementvar" command can only handle 3 arguments: valueMin, valueMax, Delta. Sadly it won't work like that, although setting just those three values changes only the X axis.

JarateKingquintoshnot possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really)quick python script for this:
# range to set
min = -2
max = 2

# enforce proper wrapping rules
def getCoords(x, y, z, separator):
    toret = ''
    toret += str((x - min) % (max - min + 1) + min) + separator
    toret += str((y - min) % (max - min + 1) + min) + separator
    toret += str((z - min) % (max - min + 1) + min) 
    return toret

# base binds
for c in ['x', 'y', 'z']:
    print('alias "inc_vm_' + c + '" "vm_0_0_0"')
print('')

# internal state binds
for x in range(min, max + 1):
    for y in range(min, max + 1):
        for z in range(min, max + 1):
            toprint = 'alias "vm_' + getCoords(x, y, z, '_') + '" "'
            toprint += 'tf_viewmodels_offset_override ' + getCoords(x, y, z, ' ') + ';'
            toprint += 'alias inc_vm_x vm_' + getCoords(x+1, y, z, '_') + ';'
            toprint += 'alias inc_vm_y vm_' + getCoords(x, y+1, z, '_') + ';'
            toprint += 'alias inc_vm_z vm_' + getCoords(x, y, z+1, '_') + '"'
            print(toprint)
There's some obvious big improvements (support for decrementing instead of just having to wrap around, and support for floats / not having to always be an integer) but this should get the idea across.

I appreciate your effort, but there are a few problems with this approach that prevented me from using it before even asking, namely:
1) TF2 config files cannot be larger than 1 Mb, which would mean those would have to be divided in a heckton files.
2)This script is great, but it would help to not involve the x axis since it is possible to manipulate it with incrementvar
3)Decrement support is another reason why this idea is even needed, it would be a tad easier with only increments.

[quote=_Kermit]You can probably do "incrementvar tf_viewmodels_offset_override x 0 150 10"[/quote]
The "incrementvar" command can only handle 3 arguments: valueMin, valueMax, Delta. Sadly it won't work like that, although setting just those three values changes only the X axis.

[quote=JarateKing][quote=quintosh]not possible in tf2 without setting aliases for every x, y, z (which isn't a lot of work if you use autofill really)[/quote]
quick python script for this:
[code]# range to set
min = -2
max = 2

# enforce proper wrapping rules
def getCoords(x, y, z, separator):
toret = ''
toret += str((x - min) % (max - min + 1) + min) + separator
toret += str((y - min) % (max - min + 1) + min) + separator
toret += str((z - min) % (max - min + 1) + min)
return toret

# base binds
for c in ['x', 'y', 'z']:
print('alias "inc_vm_' + c + '" "vm_0_0_0"')
print('')

# internal state binds
for x in range(min, max + 1):
for y in range(min, max + 1):
for z in range(min, max + 1):
toprint = 'alias "vm_' + getCoords(x, y, z, '_') + '" "'
toprint += 'tf_viewmodels_offset_override ' + getCoords(x, y, z, ' ') + ';'
toprint += 'alias inc_vm_x vm_' + getCoords(x+1, y, z, '_') + ';'
toprint += 'alias inc_vm_y vm_' + getCoords(x, y+1, z, '_') + ';'
toprint += 'alias inc_vm_z vm_' + getCoords(x, y, z+1, '_') + '"'
print(toprint)
[/code]There's some obvious big improvements (support for decrementing instead of just having to wrap around, and support for floats / not having to always be an integer) but this should get the idea across.[/quote]

I appreciate your effort, but there are a few problems with this approach that prevented me from using it before even asking, namely:
1) TF2 config files cannot be larger than 1 Mb, which would mean those would have to be divided in a heckton files.
2)This script is great, but it would help to not involve the x axis since it is possible to manipulate it with incrementvar
3)Decrement support is another reason why this idea is even needed, it would be a tad easier with only increments.
6
#6
0 Frags +

Alright, after some manual experiments I discovered that the original -20 to 20 value range for every axis is kinda ridicilous since most of it is impractical, and I was able to reduce the number of aliases from 1600 to just 300 (-5 to 15 for left/right and 0 to -15 on up/down) which is a little more plausible and seems like something I can manage even without the autofill, so thanks for your effort.

Alright, after some manual experiments I discovered that the original -20 to 20 value range for every axis is kinda ridicilous since most of it is impractical, and I was able to reduce the number of aliases from 1600 to just 300 (-5 to 15 for left/right and 0 to -15 on up/down) which is a little more plausible and seems like something I can manage even without the autofill, so thanks for your effort.
7
#7
0 Frags +

I started working on the script but it turns out that incrementvar sets every other variable to 0, which means I will need the brute force approach. Dammit...

I started working on the script but it turns out that incrementvar sets every other variable to 0, which means I will need the brute force approach. Dammit...
Please sign in through STEAM to post a comment.