Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Noesis python code help

Featured Replies

  • Supporter

Hi, can somebody please help me out with this?

i want to use var "RwShapeIndex" from "i loop" in "j loop"

how i can do that if anyone know. Thanks in advance!

	bs.seek(RwShapeIndexTableOffset, NOESEEK_ABS)
	for i in range(0, RwVertexInfoCount):
	    RwUnknown_0 = bs.readUShort()
	    RwUnknown_1 = bs.readUShort()
	    RwShapeIndex = bs.readUShort()

	bs.seek(RwVertexInfoOffset, NOESEEK_ABS)
	for j in range(0, RwVertexInfoCount):
	    Underline = "_"
	    RwShapeInc = j
	    RwShapeIdxNum = "{:04d}".format(RwShapeIndex)
	    RwShapeIndexTmp = str(RwShapeIdxNum)
	    print(RwShapeIndexTmp)

 

Solved by Rabatini

  • Author
  • Supporter

If you mean something like that >

RwShapeIdxNum = "{:04d}".format(RwShapeIndex[i])

it doesn't work. I also created initial var RwShapeIndex = []

Saying > 

RwShapeIdxNum = "{:04d}".format(RwShapeIndex[i])
TypeError: 'int' object is not subscriptable

 

Edited by h3x3r

  • Supporter

yeah, that's the reason I usually don't use python.

There's solutions which say:

Quote

To fix this error, you need to convert the integer to an iterable data type, for example, a string.

but that sounds funny to me.

  • Author
  • Supporter

Already tried. No luck... Yeah i like python too... 🙃Anyway thank you for your time.

  • Supporter
  • Solution

Did you tried Store RwShapeIndex Values in a List?

Somenthing like that?
 

bs.seek(RwShapeIndexTableOffset, NOESEEK_ABS)
rw_shape_indices = []  # Create a list to store RwShapeIndex values
for i in range(0, RwVertexInfoCount):
    RwUnknown_0 = bs.readUShort()
    RwUnknown_1 = bs.readUShort()
    rw_shape_indices.append(bs.readUShort())  # Append to the list

bs.seek(RwVertexInfoOffset, NOESEEK_ABS)
for j in range(0, RwVertexInfoCount):
    Underline = "_"
    RwShapeInc = j
    RwShapeIndex = rw_shape_indices[j] #get the value from the list using the j index.
    RwShapeIdxNum = "{:04d}".format(RwShapeIndex)
    RwShapeIndexTmp = str(RwShapeIdxNum)
    print(RwShapeIndexTmp)

 

  • Supporter

That's funny. Isn't rw_shape_indices a list of ints (shorts) while python claims an array of ints not to be subscriptable?

The magic is append - apparently python prefers lists over arrays because these have a fixed size.

  • Supporter
59 minutes ago, shak-otay said:

That's funny. Isn't rw_shape_indices a list of ints (shorts) while python claims an array of ints not to be subscriptable?

The magic is append - apparently python prefers lists over arrays because these have a fixed size.

Lists are the default go-to dynamic sequence type in Python because of their flexibility.
The append method works naturally on lists, while array.append() requires that the appended value be of the correct type.
Many Python libraries and frameworks default to lists for simplicity.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.