Git Product home page Git Product logo

Comments (14)

katawful avatar katawful commented on September 15, 2024 1

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.

Forlini91 avatar Forlini91 commented on September 15, 2024 1

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.

llde avatar llde commented on September 15, 2024

what about using $stingVar in the map bracket?

from xobse.

EdMSL avatar EdMSL commented on September 15, 2024

It works, thanks

from xobse.

EdMSL avatar EdMSL commented on September 15, 2024

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.

katawful avatar katawful commented on September 15, 2024

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.

EdMSL avatar EdMSL commented on September 15, 2024

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.

katawful avatar katawful commented on September 15, 2024

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.

EdMSL avatar EdMSL commented on September 15, 2024

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.

katawful avatar katawful commented on September 15, 2024

MyQuest isn't a variable

from xobse.

EdMSL avatar EdMSL commented on September 15, 2024

What is MyQuest ? Is this a Reference?

from xobse.

katawful avatar katawful commented on September 15, 2024

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.

EdMSL avatar EdMSL commented on September 15, 2024

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.

EdMSL avatar EdMSL commented on September 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.