Comments (14)
Quest variables behave like namespaces in other languages (e.g. std::cout
in C++, string.format
in Lua, etc...). They're a token themselves and work as a whole. There's no other way to access quest variables
You can do $quest.variable
to stringicize quest variables as $
operates on the whole of the quest variable. You need to include this all if you want to use $
[]
is for subscripting arrays and strings. It is not for anything else
from xobse.
You can use this GetVariable
scn MyQuestScript ; from questo MyQuest
float myVar
float anotherMyVar
string_var nameOfProperty
float value
...
let nameOfProperty := "myVar" ; or "anotherMyVar"
let value := GetVariable $nameOfProperty MyQuest
from xobse.
what about using $stingVar in the map bracket?
from xobse.
It works, thanks
from xobse.
Can I get the value of variable of another quest in a similar way?
F.e. there is a variable someVariable on any quest script for quest with name "SomeQuest".
scn SomeQuestScn
short someVariable
//some other code
and I want to get value of this someVariable variable from my another script. By default we write:
scn MyScript
short myvar
Let myvar := SomeQuest.someVariable
Is there any way to get value by variable?
Let stingVar := "someVariable "
Let myvar := SomeQuest[$stingVar ] // not works
from xobse.
Quest variables are scoped by itself:
; quest script
scn quest
int i
array_var a
; other script
string_var string
array_var array
let x := quest.a[$string]
let x := array[$quest.i]
They accept all operators as well
from xobse.
Yes, but I want to get value of variable from another script by string:
let sting := "a"
let x := quest[$string]
//or
let x := quest["a"]
from xobse.
I'm not sure what you're asking exactly, all quest variables are scoped like so: quest-ref-name.variable-ref-name
If you want to get the value of said quest var by string, you can still stringicize with $
Let x := some_array[$quest.var]
If you want to get the value of a quest array variable you can still do that:
Let x := quest.var[$some_array]
from xobse.
This is a quest script for MyQuest:
scn MyQuestScript
short attempts
short doonce
begin MenuMode
if doonce != 1
set attempts to 10
set doonce to 1
endif
end
This is an another script:
scn GetAttemptsScript
string_var text
short data
short isGetData
begin GameMode
if isGetData != 1
// by default we write:
let data := MyQuest.attempts //data will be 10
// but I want:
let text := "attempts"
let data := MyQuest[$text] //not works
set isGetData to 1
endif
end
from xobse.
MyQuest
isn't a variable
from xobse.
What is MyQuest ? Is this a Reference?
from xobse.
You did let data := MyQuest[$text]
MyQuest
is not a variable, and also doesn't seem to be a valid reference either (like a quest reference). You can only subscript or member access array and string variables
from xobse.
Ok. You writed:
all quest variables are scoped like so: quest-ref-name.variable-ref-name
I should to write
let quest-ref-name.variable-ref-name := 1
Is there any way to replace variable-ref-name by value of var_string?
var_string x
let x := "some"
let quest-ref-name[$x] := 1 //not works
from xobse.
Is there something similar to this for setting a quest variable?
P.S. I think I can use RunScriptLine function.
from xobse.
Related Issues (20)
- 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
- Suggestion: add syntax to allow adding event handlers directly. HOT 4
- Question: language standard, pull requests. HOT 4
- Suggestion: add functions to retrieve creature's Blood spray and Blood decal file paths.
- Remove limitation on using array of arrays for ar_CustomSort.
- xOBSE 22.10beta causes console spam for Lovers with PK script xx0090ea HOT 9
- Suggestion: add new Array type: RefMap.
- Wont work - Application Ioad error 5:0000065434 HOT 5
- Console Spam With Dynamic Mesh Swappers Like Blockhead HOT 1
- Not compatible with Enhanced Hotkeys & FormID Finder? HOT 2
- RemoveEventHandler and OnKey events HOT 1
- Minor Wiki Typo
- sv_Replace(StringVar::Replace function in StringVar.cpp) does not take into account when the target is a multibyte character(Problems occurred with Ultimate Leveling in Japanese environment.) HOT 2
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.