Comments (4)
All menu functions (including for MenuQue) support format specifiers. e.g.:
SetMenuFloatValue "some\tile\%g", 1
You can also use them for functions that need a pipe character |
but I don't have an example off the top of my head
from xobse.
All menu functions (including for MenuQue) support format specifiers. e.g.:
SetMenuFloatValue "some\tile\%g", 1
You can also use them for functions that need a pipe character
|
but I don't have an example off the top of my head
I have tried: GetTileChildren "%z", TilePath 1011
That just gives me the compile error "Unknown variable FilePath for parameter in."
from xobse.
Of all menu commands GetTileChildren and GetTileTraits accept "strings" but not "formatString", which means you can't build the string like that.
When an argument is a "formatString", you can pass extra arguments which will replace the placeholders in the string.
Instead, a "string" argument won't accept extra arguments and you must build the string in some other way.
There are 2 solutions to this problem:
- Extract the string from the string_var with the $ operator
string_var TilePath
...
set TilePath to sv_Construct "name1/name2/name3"
GetTileChildren $TilePath 1011
sv_Destruct TilePath
- Directly use a quoted string
GetTileChildren "name1/name2/name3" 1011
If you enable the OBSE compiler in that script block (in OBSE Documentation search "Using OBSE expressions in scripts"), you can also build the string in place, example:
string_var middleName
...
let middleName := "name2"
GetTileChildren ("name1/" + $middleName + "/name3") 1011
sv_Destruct middleName
SHORT EXPLANATION:
These commands accept "string" arguments but not "string_var" variables, which means you must "extract" the string from the string_var.
To extract a string from a string_var use the $ operator: it casts ANYTHING to string (extract the string contained in a string_var, convert a number to string, get the "name" of a reference, etc...)
LONG EXPLANATION:
Yes, it's not intuitive. String_var variables are not usable in place of strings (unless you use the $ operator).
String_var and Array_var variables not native in the Oblivion script language. They have been created by the OBSE team and they works similar to a "Ref" type/variable, because they only hold the numeric "reference" or "ID" of the string or the array, not the string/array itself (under the hood, they are actually "numeric" types like the Ref variables).As a consequence, if you pass a string_var/array_var variable as input to any command means you're passing its numeric ID to the command, which, like in the issue you encountered, means passing a number to a command expecting a pure string. Also, a command argument may either accept a pure string or a string_var, not boths at the same time (so existing Oblivion/OBSE commands can't be "patched" to accept both types).
Luckily, that's not a problem, as arguments accepting a "string" can still be feed a string_var by using the $ operator to extract the contained string, while argument accepting a string_var can be feed a string if you assign that string to a string_var first.The same problem doesn't happen with arrays, because commands may only accept "references" to array
from xobse.
Ah, I knew it missed something. Your explanation also answers a number of (I thought) totally unrelated thoughts I had while looking at the OBSE source.
Wonderful explanation, thank you so much!
from xobse.
Related Issues (20)
- Get value from stringMap by variable HOT 14
- Latest version breaks mod organizer 2 HOT 1
- message saying "The latest Oblivion Script Extender is not detected. morroblivion requires the latest version of xOBS€ to run, Please exit the game now and check your installation" I am using xOBSE 22.7.
- OnControlEvent returns wrong "action" when triggered by mouse buttons HOT 3
- C2 Special Combat Moves HOT 5
- Input Functions Not Working with TES4JaPatch016_beta3 HOT 10
- Apparel items do not return their icon path.
- Dynamic mesh swap mods have issues HOT 1
- Why do unvoiced npcs say "How can I help you?" and how to get rid of that? HOT 1
- Some issues regarding PushActorAway
- Rewrite and Streamline the User Function manager
- Per-Script InvenotryReferences
- GetAlchMenuApparatus doesn't work as documented HOT 2
- 22.9 wont work for some reason HOT 3
- obse error HOT 4
- [xOBSE22.2-xOBSE22.9]Input functions are not functioning properly with obcn_12416.dll, a Chinese localization plugin HOT 22
- Shows completely black window for half a second, then CTD. HOT 1
- A way of detecting which topic, line and response is currently being said in dialogue
- ModTable::Get().GetModIndex giving the wrong index HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xobse.