tons of variables.

Blitz3D Forums/Blitz3D Beginners Area/tons of variables.

chwaga(Posted 2007) [#1]
I'm constructing a tree-style conversation system for my game. The NPC will say something, and the player is given a list of replies each reply having it's own NPC response, and so on, AKA tree-style. This method will require a massive amount of variables for each conversation, so I was wondering how to manage these without producing too much lag. Each conversation will be generated into a function. Would making local variables inside the function omit the locals once the function's process is complete?

Any help is greatly appreciated.


semar(Posted 2007) [#2]
I would use a Type structure instead of a whole of variables.

You may use two types, one for the NPC and one fot the user, to be filled each time with the list of repies.

Sergio.


chwaga(Posted 2007) [#3]
I'm a real noob to types...It always bugs when I try to use them, could you give an example how?

Also, on a different topic, when I create a loop like this
Function conv()
npc1$ = "Hello"
r1$ = "Hi"
Repeat

If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3) Then
Color 50, 50, 245
Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3), displaywidth, 12, 1
Color 255, 255, 255
EndIf
Color 0,0,0
Rect 0,0,displaywidth,displayheight/4,1
Color 0,0,0
Rect 0,(displayheight/4)*3,displaywidth,displayheight/4,1
Color 255, 255, 255
If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3) Then
Color 50, 50, 245
Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3), displaywidth, 12, 1
Color 255, 255, 255
EndIf
If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12 +50) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3)+50 Then
Color 50, 50, 245
Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3)+50, displaywidth, 12, 1
Color 255, 255, 255
EndIf
If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3)+12+100) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3)+100 Then
Color 50, 50, 245
Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3)+100, displaywidth, 12, 1
Color 255, 255, 255
EndIf
Text 250,100, "Hello"
Text 250,((displayheight/4)*3)+((displayheight/4)*.3), "Hi"
Text 250,((displayheight/4)*3)+((displayheight/4)*.3)+50, "How are you?"
Text 250,((displayheight/4)*3)+((displayheight/4)*.3)+100, "Goodbye"
Until KeyHit(1)
End Function


to be executed upon hitting a key, why does it just freeze up until i hit escape and not preform any of the graphic and text commands?


GitTech(Posted 2007) [#4]
Flip()?


chwaga(Posted 2007) [#5]
excellent, is there a way to still display 3d animations while that loop is running (make animations run while that loop is going?)?


Adam Novagen(Posted 2007) [#6]
I'm a real noob to types...

You may already know this, but however long it takes to learn, you should REALLY try to become as fluent as possible in Types; personally, I think they're one of the best features B3D has to offer.