Tutorial for text input with OBSE input functions?

Post » Fri Feb 18, 2011 7:58 pm

Look for a good tutorial that isn't outdated, or, even made obsolete..... OBSE has come a long way since Tibixi's String functions etc, but, most of the stuff I have found on the CS wiki is old, and no longer really applies. Are there any other resources out there in the world for this?
User avatar
CArla HOlbert
 
Posts: 3342
Joined: Wed Feb 21, 2007 11:35 pm

Post » Fri Feb 18, 2011 9:41 pm

OBSE docs contain a http://obse.silverlock.org/obse_command_doc.html#Text_Input_Functions. What else do you need to know?
User avatar
Damien Mulvenna
 
Posts: 3498
Joined: Wed Jun 27, 2007 3:33 pm

Post » Sat Feb 19, 2011 6:23 am

Thank You. :D Absolutely perfect. Precisely what I was looking for. You are da MAN!
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Sat Feb 19, 2011 9:04 am

Another question.......

Will array variables be 'remembered' from a save/load cycle? Save/exit/load? Or, do I need to do something special to have values still there after exiting the game?
User avatar
Rich O'Brien
 
Posts: 3381
Joined: Thu Jun 14, 2007 3:53 am

Post » Sat Feb 19, 2011 1:03 am

Another question.......

Will array variables be 'remembered' from a save/load cycle? Save/exit/load? Or, do I need to do something special to have values still there after exiting the game?

The values of array (and string) variables persist exactly the same way the values of ordinary variables do: they are stored in the savegame. So when you save the game, all arrays currently in memory are saved as well. When you load a savegame, any arrays currently in memory are wiped out and replaced by the arrays associated with the newly-loaded savegame. Whether you exit the game in between saving and loading doesn't make a difference.

So if you create a new array, assign it to an array_var, and then reload an earlier save, your newly-created array is gone forever.
If you create and assign a new array, save the game, and reload, your new array will still be there.
Further, if you create, assign, and save, then modify the new array (e.g. add/remove elements), and then reload the save, the array will contain the values it had before you modified it. Just like ordinary script variables.

Let me know if that doesn't clarify things.
User avatar
MarilĂș
 
Posts: 3449
Joined: Sat Oct 07, 2006 7:17 am

Post » Sat Feb 19, 2011 2:37 am

That's what I was looking for, thank you.

Although, I seem to be having trouble finding info on multi dimensional arrays.......such as:

array_var [1,2]
.
.
.
.
array_var [1,6]

Etcetera. So far, all I have seen is single 'key' arrays, can I use the form shown above for multiple values in a 'single' variable, so to speak?

Also, is there a way to tell if an interior cell is in the SI world? GetParentWorldspace doesn't seem to do so.......
User avatar
Aman Bhattal
 
Posts: 3424
Joined: Sun Dec 17, 2006 12:01 am

Post » Sat Feb 19, 2011 9:07 am

So far, all I have seen is single 'key' arrays, can I use the form shown above for multiple values in a 'single' variable, so to speak?

Sort of. You write arr[i][j][k][...etc...].
In a multi-dimensional array each element is another array. So you have a couple of options for constructing it.
array_var arrarray_var innershort value; construct a 4x2 arraylet arr := ar_construct arraylet arr[0] := ar_list 1 2let arr[1] := ar_list 3 4let arr[2] := ar_list 5 6let arr[3] := ar_list 7 8print $arr[2][1] ; prints '6'; or more compactlylet arr := ar_list (ar_list 1 2), (ar_list 3 4), (ar_list 5 6), (ar_list 7 8); you can refer to arrays inside your main array, e.g.let inner := arr[1]print $inner[0] ; prints '3'; so this:let value := arr[1][0]; is exactly equivalent to this:let inner := arr[1]let value := inner[0]

The array doesn't have to be square, it can be jagged - in other words the length of one inner array doesn't have to match the length of any of the other inner arrays
let arr := ar_list (ar_list 1 2 3 4 5 6), (ar_list 7); arr[0] is a 6-element array. arr[1] is a one-element array

User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Sat Feb 19, 2011 7:30 am

Makes my brain hurt..... :D

Ok, here's what I am trying to do. I want to construct an array, such that it will contain the values:

mark name
cell name
x position
y position
z position
world space. <- this one is going to be tricky...... if I can't find a way to determine an interior cells containing worldspace..... cross that bridge when I come to it.

(yes, I am working on doing up a multi-mark mod....)

Now, if I understand this correctly, I can use ar_list, to assign those values, to a single array element. Correct? Do the values I am putting into the list command have to be array values? could I just assign the values directly to the array list?? (probably not?)

And how would I recover the individual values from the list again??
I am having a REAL hard time wrapping my brain around this. :D Thanks for the assist.
User avatar
Nathan Hunter
 
Posts: 3464
Joined: Sun Apr 29, 2007 9:58 am

Post » Sat Feb 19, 2011 9:46 am

ar_list takes a list of values of any type(s) and returns an array. The values can be strings, numbers, refs, or arrays; any mix of these is fine too.
It sounds like you are talking about a StringMap rather than an Array with integer indices. There is an ar_Map which is similar to ar_List; look it up if you think it might be useful, but it's not necessary for this.
If you want to use an array to store your marks, you might consider doing something like this to reduce brain-hurtiness:
scn FnCreateMark; function parametersstring nameref cellfloat xfloat yfloat z; local variablesarray_var markbegin Function { name, cell, x, y, z }  ; fill out the info for this mark  let mark := ar_construct StringMap  let mark->name = name  let mark->cell = cell  let mark->x = x  let mark->y = y    ; send the new mark back to the calling script  SetFunctionValue markend


scn MarkManagerScriptarray_var marks...if (you didn't initialize the array yet)  let marks := ar_construct Stringmapendif...if (you want to create a new mark and you've gotten the player to enter a name for it)  let marks[markName] := Call FnCreateMark markName, player.getParentCell, player.getPos x, player.GetPos y, player.getPos zendif

marks is a StringMap instead of an Array because I made the assumption you want to have a unique name for each mark. If that's not the case then you can use an Array instead, and each time you create a new mark you append it to your Array.

To use a mark you might have something like (just an example for showing the syntax):
; assume the player has entered the name of the mark he wants to return to, or you've gotten it from elsewherearray_var markstring_var markNamelet mark := marks[markName]print "Do you want to travel to position (" + $mark->x + ", " + $mark->y + ", " + $mark->z + ") in " + getName mark->cell + "?"

arr->key is shorthand for accessing an element of a stringmap. It is equivalent to:
arr["key"]

User avatar
Jade MacSpade
 
Posts: 3432
Joined: Thu Jul 20, 2006 9:53 pm

Post » Sat Feb 19, 2011 2:52 am

Thank You. I think I am actually starting to get a handle on this....... most helpful. I am gonna have to actually do some script writing, and see where I run into issues. You have given me a great deal of food for thought.

I'll be back though. :D
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Fri Feb 18, 2011 10:49 pm

Is it possible to use a variable for an array key?
User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm

Post » Sat Feb 19, 2011 1:15 am

Is it possible to use a variable for an array key?

Yes. If your array key is a number, just use any short or float, to manually loop through the content of an array, do something like this.

short index...let index := 0While index < ar_Size myArray	let val := myArray[index]	...	let index += 1Loop 


If you have a string map where the key is a string, use a string_var for the variable instead of a short or float.
User avatar
mishionary
 
Posts: 3414
Joined: Tue Feb 20, 2007 6:19 am

Post » Sat Feb 19, 2011 5:27 am

Excellent!!! Thank You.
User avatar
Mackenzie
 
Posts: 3404
Joined: Tue Jan 23, 2007 9:18 pm


Return to IV - Oblivion