Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gumby

Pages: [1] 2 3 ... 58
1
#6 does it for me.  Nice contrasts.

2
AGI Development Tools / Re: C# AGI Interpreter
« on: December 14, 2016, 07:20:32 PM »
Yes, but the work that I did probably is not the most performant.  Though with current hardware it probably isn't a huge issue.  Hopefully it'll help on some level.

3
Yeah, you should have seen my first cut at dithering.  Tried to color in every other pixel instead of using lines.  Horrifically slow :P

4
SCI Community How To's & Tutorials / SCI0 - Graph fill box and Dithering
« on: November 27, 2016, 10:58:59 AM »
The Graph() kernel method doesn't support using a dithered color.  So to overcome this I wrote this procedure:

Code: [Select]
(procedure (GraphDither y1 x1 y2 x2 clColor1 clColor2)
   (var xI, xII, yI, yII, yOdd)
   
          Graph(grFILL_BOX y1 x1 y2 x2 VISUAL clColor1)
     
          = yOdd 0
  (if (<> (% (- y2 y1) 2) 0)
    = yOdd 1
  )
 
  = xI x1
  = yI (- y2 2)
  = xII (- (+ x1 2) 1)
  = yII (- y2 1)
 
          (if (yOdd)
     = yI (- y2 1)
     = xII x1  
  )

  (while (1)
             (if ((>= xII x2))
                = xII (- x2 1)
                = yII (- yII 1)
      )
     
      Graph(grDRAW_LINE yI xI yII xII clColor2)
     
      (if (<= (+ xII 2) x2)
    = xII (+ xII 2)
      )(else
  = yII (- yII 2)
      )
 
      (if (>= (- yI 2) y1)
    = yI (- yI 2)
      )(else
      = xI (+ xI 2)        
      )

      (if (>= xI x2)
   break
      )
  )
)

The procedure starts by drawing a box with the first specified color, then draws parallel lines (slope = 1) which colors every other pixel in the box with the 2nd dither color.

5
SCI Development Tools / Re: Scene Builder
« on: November 26, 2016, 10:42:36 AM »
Sure enough, the single instance doesn't work upon a restore.  Guess I'll need to go with option #2 then.

6
SCI Development Tools / Re: Scene Builder
« on: November 25, 2016, 02:02:31 PM »
I couldn't get PVs to work initially, but decompiling LSL3 did help me work through it.  I tested three different scenarios, with 19 different views for each test:

1) Creating a new View instance on-the-fly (no instance reuse).  This was the worst scenario, with 18,862 bytes of heap remaining.
2) Creating a new PV instance on-the-fly (no instance reuse).  Better, with 19,414 bytes of heap remaining.
3) Created a single PV instance & reused it.  Best, with 20,062 bytes of heap remaining

So there we have it.  Looks like I'll be sticking with #3.

7
SCI Development Tools / Re: Scene Builder
« on: November 22, 2016, 07:57:52 AM »
I'll do some testing on memory consumption of the resulting game scripts.  Never used a PV instance before, after looking at the class it looks like it would consume less memory than a view (less class properties, less methods) and it has everything I need.  I'll see if using PVs will improve the memory footprint more.

8
SCI Development Tools / Re: Scene Builder
« on: November 20, 2016, 12:44:46 PM »
New version uploaded:

- Save functionality now writes out two scripts per room, one in 'Studio' format and the other in 'Sierra' format
- Change room generation to not create view instances to reduce generated script size
- Now possible to interact with generated scene for fine-tuning. Views can be moved, changed to a different view and/or priorities updated.

9
SCI Development Tools / Re: Scene Builder
« on: November 14, 2016, 09:23:58 PM »
Definitely an interesting tool. Is there a reason you're not using the Sierra syntax? :-)

Nope, I will add in the Sierra syntax in the next version.

fyi, in the version currently uploaded, it produces scripts that don't compile. Some parentheses are in the wrong place.

Whoops, I didn't run into that.  I'll check that out.  I probably made some change and didn't fully test it out.

10
SCI Development Tools / Re: Scene Builder
« on: November 13, 2016, 05:08:01 PM »
Good catch Lars, in fact in the scene builder rm001, I do only have a single instance of a view and re-use it each time I add a new view.   I will be needing to create one instance per view in the future; I'm planning on not addToPic'ing them so that the user can click/drag it around as they wish before saving out the room definition.  But this doesn't mean that I can't fix the room script generation to only use a single instance.

MI, as for creating pics instead of views it would be much harder to do (for me anyway), creating vector art instead of just creating new views from existing portions of pics.

11
SCI Development Tools / Re: Scene Builder
« on: November 13, 2016, 10:45:27 AM »
Initial version uploaded to the games page, very pleased with how it turned out:  http://sciprogramming.com/fangames.php?action=review&id=202

Very easy to use, just input your parameters on room startup and after the room is rendered, any keyboard/mouse input will bring up the cancel/skip/save dialog.  If you choose to save, it'll write out a complete room script (in the game directory) including references of the views to reproduce the scene.  From there all you'll need to do is export the related views into your game & copy/paste the room script text.

The current library of views (over 200 to choose from) is based on the rooms from the KQ1 SCI.

12
Multi column support added:

Code: [Select]
(procedure public (PrintMultiEdit params)
(var hDialog, hDText, hIcon, hEdits[25], btnPressed, paramCnt, diagX, diagY,
maxWidth, newPrintDlg, hFirstEnabled, oldPort, hButtons[6], btnsWidth,
buttonCnt, btnX, msgBuf[1013], moveToX, moveToY, editCnt, leftMargin[25], editColNum[25],
  fontHeight, xPos, yPos, columnCount)
= diagY  -1
= diagX  -1
= buttonCnt 0
= editCnt 0
= hEdits  NULL
= hIcon  NULL
= btnsWidth 0
= maxWidth  0
= newPrintDlg  NULL
= hDialog (Dialog:new())
(send hDialog:
window(gTheWindow)
name("PrintD")
)
= hDText (DText:new())
(if(<u params[0] 1000)
GetFarText(params[0] params[1] @msgBuf)
= paramCnt 2
)(else
  (if(params[0])
  StrCpy(@msgBuf params[0])
  = paramCnt 1
)(else
= msgBuf 0
= paramCnt  0
)
)
(send hDText:
text(@msgBuf)
moveTo(4 4)
font(gDefaultFont)
setSize()
)

(send hDialog:add(hDText))


  (while(< paramCnt paramTotal)
  (switch(params[paramCnt])
  (case #mode
  ++paramCnt
  (send hDText:mode(params[paramCnt]))
)
(case #font
  ++paramCnt
  (send hDText:
  font(params[paramCnt])
  setSize(maxWidth)
  )
)
(case #width
= maxWidth params[++paramCnt]
(send hDText:setSize(maxWidth))
)
(case #time
++paramCnt
(send hDialog:time(params[paramCnt]))
)
(case #title
++paramCnt
(send hDialog:text(params[paramCnt]))
)
(case #at
= diagX params[++paramCnt]
= diagY params[++paramCnt]
)
(case #draw
Animate(
(send gCast:elements)
0
)
)
(case #edit
++paramCnt
= hEdits[editCnt] (DEdit:new())

(send hEdits[editCnt]:
text(params[paramCnt])
)

++paramCnt
(send hEdits[editCnt]:
max(params[paramCnt])
setSize()
)

= leftMargin[editCnt] params[++paramCnt]
= editColNum[editCnt] params[++paramCnt]

// if this is the first edit control, extra parameters
(if (== 0 editCnt)

  = fontHeight params[++paramCnt] //get the font height value (required), spacing between edit controls vertically
  = columnCount params[++paramCnt]
)

++editCnt
)

(case #button
    = hButtons[buttonCnt] (DButton:new())
(send hButtons[buttonCnt]:
text(params[++paramCnt])
value(params[++paramCnt])
setSize()
    )
    = btnsWidth (+ btnsWidth (+ (send hButtons[buttonCnt]:nsRight) 4))
    ++buttonCnt
)

(case #icon
(if(IsObject(params[+ paramCnt 1]))
= hIcon (send params[+ paramCnt 1]:new())
(send hIcon:setSize())
= paramCnt (+ paramCnt 1)
    )(else
    = hIcon (DIcon:new())
    (send hIcon:
    view(params[+ paramCnt 1])
    loop(params[+ paramCnt 2])
    cel(params[+ paramCnt 3])
    setSize()
    )
    = paramCnt (+ paramCnt 3)
    )
)
(case #dispose
(if(gPrintDlg)
(send gPrintDlg:dispose())
)
= newPrintDlg hDialog
)
(case #window
++paramCnt
(send hDialog:window(params[paramCnt]))
)
)
++paramCnt
)
(if(hIcon)
(send hIcon:moveTo(4 4))
(send hDText:moveTo( (+ 4 (send hIcon:nsRight)) (send hIcon:nsTop) ))
(send hDialog:add(hIcon))
)
  (send hDialog:setSize())
 
= paramCnt 0
(while(< paramCnt editCnt)

    = xPos (+ (* 20 editColNum[paramCnt])   (+ leftMargin[paramCnt]  (send hDText:nsLeft)))
            = yPos (- (+ (* (* -1 fontHeight) (/ (-(- editCnt paramCnt)1) columnCount))  (send hDText:nsBottom)) fontHeight)

    (send hEdits[paramCnt]:moveTo(xPos yPos))
   
    (send hDialog:
    add(hEdits[paramCnt])
    setSize()
    )
   
++paramCnt
)


  (if(> btnsWidth (send hDialog:nsRight))
= btnX 4
)(else
  = btnX (- (send hDialog:nsRight) btnsWidth)
        //If you wanted the button centered...
        //   = btnX / ( - (send hDialog:nsRight) btnsWidth ) 2
)

= paramCnt 0
(while(< paramCnt buttonCnt)
(send hButtons[paramCnt]:moveTo( btnX (send hDialog:nsBottom) ))
(send hDialog:add(hButtons[paramCnt]))
= btnX (+ 4 (send hButtons[paramCnt]:nsRight))
++paramCnt
)

  (send hDialog:
  setSize()
  center()
  )
  (if(hIcon and not StrLen(@msgBuf))
(send hIcon:
moveTo(
    (
    / (- (- (send hDialog:nsRight) (send hDialog:nsLeft))
    (- (send hIcon:nsRight) (send hIcon:nsLeft))) 2
    )
    4
    )
)
)

(if(== -1 diagX)
= moveToX (send hDialog:nsLeft)
)(else
= moveToX diagX
)
(if(== -1 diagY)
= moveToY (send hDialog:nsTop)
)(else
= moveToY diagY
)
  (send hDialog:moveTo( moveToX moveToY ))

= oldPort GetPort()

(if(send hDialog:text)
= moveToX nwTITLE
)(else
= moveToX nwNORMAL
)
(if(newPrintDlg)
= moveToY 15
)(else
= moveToY -1
)
(send hDialog:open(moveToX moveToY))

(if(newPrintDlg)
= gOldPort GetPort()
SetPort(oldPort)
return(= gPrintDlg newPrintDlg)
)
  (if( (= hFirstEnabled (send hDialog:firstTrue(#checkState 1)))
       and (not (send hDialog:firstTrue(#checkState 2)) ) )
    (send hFirstEnabled:state(| (send hFirstEnabled:state) 2))
)
  = btnPressed (send hDialog:doit(hFirstEnabled))
  (if(== btnPressed -1)
= btnPressed 0
)

  (for (= paramCnt 0) (< paramCnt buttonCnt) (++paramCnt)
  (if(== btnPressed hButtons[paramCnt])
    = btnPressed (send btnPressed:value)
    break
)
)
  (if(not (send hDialog:theItem) )
= btnPressed 1
)
  (send hDialog:dispose())

return(btnPressed)
)

Room script:
Code: [Select]
(instance RoomScript of Script
    (properties)
    (method (handleEvent pEvent)

    (var  inp1[2],  inp2[2],  inp3[2],  inp4[2],  inp5[2],  inp6[2],  inp7[2],  inp8[2],  inp9[2], inp10[2],
    inp11[2], inp12[2], inp13[2], inp14[2], inp15[2], inp16[2], inp17[2], inp18[2], inp19[2], inp20[2],
    attributes[100])

        (super:handleEvent(pEvent))

    = inp1 0
    = inp2 0
    = inp3 0
    = inp4 0
    = inp5 0
            = inp6 0
    = inp7 0
    = inp8 0
            = inp9 0
            = inp10 0
    = inp11 0
    = inp12 0
    = inp13 0
    = inp14 0
    = inp15 0
    = inp16 0
    = inp17 0
    = inp18 0
            = inp19 0
            = inp20 0     
                       
   PrintMultiEdit("20 Inputs:\n\n       A    B    C    D    E  \n1:\n2:\n3:\n4:"
                                                                  // inputbox size, left margin, column placement, font height, column count
    #edit @inp1   2 0 1 12 5
    #edit @inp2   2 0 2
    #edit @inp3   2 0 3
    #edit @inp4   2 0 4
    #edit @inp5   2 0 5
    #edit @inp6   2 0 1
    #edit @inp7   2 0 2 
    #edit @inp8   2 0 3
    #edit @inp9   2 0 4
    #edit @inp10  2 0 5
    #edit @inp11  2 0 1
    #edit @inp12  2 0 2
    #edit @inp13  2 0 3
    #edit @inp14  2 0 4
    #edit @inp15  2 0 5
    #edit @inp16  2 0 1
    #edit @inp17  2 0 2
    #edit @inp18  2 0 3
    #edit @inp19  2 0 4
    #edit @inp20  2 0 5
    #button "  OK  " 0
   )
 

 
  )
)

Result:


Excessive?  Possibly.  I did discover that I could not go beyond 25 selectors for the Print() command, not sure where this limitation comes from (yes, I sized the input arrays to the Print procedure large enough during my testing).  Therefore, no more than 25 input boxes seem to be possible, unless I've overlooked something here.

13
I had a need to input multiple values from the user and the template game out-of-the-box only supports a single edit control in the Print routine.  Here's how you can enable multiple edit boxes in a single print statement, perhaps for that RPG you always wanted to make. 

Note that this example uses the SCI Studio syntax, not the Sierra syntax.

Make a new procedure called PrintMultiEdit() based on the Print() procedure in Controls.sc.  You could just override the existing Print() procedure, but you'll need to make other changes everywhere an #edit is used in existing Print statements in the template code (shouldn't be too hard, but left out here for brevity).

Code: [Select]
(procedure public (PrintMultiEdit params)
(var hDialog, hDText, hIcon, hEdits[10], btnPressed, paramCnt, diagX, diagY,
maxWidth, newPrintDlg, hFirstEnabled, oldPort, hButtons[6], btnsWidth,
buttonCnt, btnX, msgBuf[1013], moveToX, moveToY, editCnt, leftMargin[10],fontHeight)
= diagY  -1
= diagX  -1
= buttonCnt 0
= editCnt 0
= hEdits  NULL
= hIcon  NULL
= btnsWidth 0
= maxWidth  0
= newPrintDlg  NULL
= hDialog (Dialog:new())
(send hDialog:
window(gTheWindow)
name("PrintD")
)
= hDText (DText:new())
(if(<u params[0] 1000)
GetFarText(params[0] params[1] @msgBuf)
= paramCnt 2
)(else
  (if(params[0])
  StrCpy(@msgBuf params[0])
  = paramCnt 1
)(else
= msgBuf 0
= paramCnt  0
)
)
(send hDText:
text(@msgBuf)
moveTo(4 4)
font(gDefaultFont)
setSize()
)

(send hDialog:add(hDText))


  (while(< paramCnt paramTotal)
  (switch(params[paramCnt])
  (case #mode
  ++paramCnt
  (send hDText:mode(params[paramCnt]))
)
(case #font
  ++paramCnt
  (send hDText:
  font(params[paramCnt])
  setSize(maxWidth)
  )
)
(case #width
= maxWidth params[++paramCnt]
(send hDText:setSize(maxWidth))
)
(case #time
++paramCnt
(send hDialog:time(params[paramCnt]))
)
(case #title
++paramCnt
(send hDialog:text(params[paramCnt]))
)
(case #at
= diagX params[++paramCnt]
= diagY params[++paramCnt]
)
(case #draw
Animate(
(send gCast:elements)
0
)
)
(case #edit
++paramCnt
= hEdits[editCnt] (DEdit:new())

(send hEdits[editCnt]:
text(params[paramCnt])
)

++paramCnt
(send hEdits[editCnt]:
max(params[paramCnt])
setSize()
)

= leftMargin[editCnt] params[++paramCnt]

// if this is the first edit control, get the required font height value
(if (== 0 editCnt)
  = fontHeight params[++paramCnt]
)

++editCnt
)

(case #button
    = hButtons[buttonCnt] (DButton:new())
(send hButtons[buttonCnt]:
text(params[++paramCnt])
value(params[++paramCnt])
setSize()
    )
    = btnsWidth (+ btnsWidth (+ (send hButtons[buttonCnt]:nsRight) 4))
    ++buttonCnt
)

(case #icon
(if(IsObject(params[+ paramCnt 1]))
= hIcon (send params[+ paramCnt 1]:new())
(send hIcon:setSize())
= paramCnt (+ paramCnt 1)
    )(else
    = hIcon (DIcon:new())
    (send hIcon:
    view(params[+ paramCnt 1])
    loop(params[+ paramCnt 2])
    cel(params[+ paramCnt 3])
    setSize()
    )
    = paramCnt (+ paramCnt 3)
    )
)
(case #dispose
(if(gPrintDlg)
(send gPrintDlg:dispose())
)
= newPrintDlg hDialog
)
(case #window
++paramCnt
(send hDialog:window(params[paramCnt]))
)
)
++paramCnt
)
(if(hIcon)
(send hIcon:moveTo(4 4))
(send hDText:moveTo( (+ 4 (send hIcon:nsRight)) (send hIcon:nsTop) ))
(send hDialog:add(hIcon))
)
  (send hDialog:setSize())
 
= paramCnt 0
(while(< paramCnt editCnt)
    (send hEdits[paramCnt]:moveTo(
    (+ leftMargin[paramCnt] (send hDText:nsLeft))
    (+ (- (send hDText:nsBottom) (* fontHeight editCnt)) (* fontHeight (paramCnt)))
    ))
    (send hDialog:
    add(hEdits[paramCnt])
    setSize()
    )
   
++paramCnt
)


  (if(> btnsWidth (send hDialog:nsRight))
= btnX 4
)(else
  = btnX (- (send hDialog:nsRight) btnsWidth)
        //If you wanted the button centered...
        //   = btnX / ( - (send hDialog:nsRight) btnsWidth ) 2
)

= paramCnt 0
(while(< paramCnt buttonCnt)
(send hButtons[paramCnt]:moveTo( btnX (send hDialog:nsBottom) ))
(send hDialog:add(hButtons[paramCnt]))
= btnX (+ 4 (send hButtons[paramCnt]:nsRight))
++paramCnt
)

  (send hDialog:
  setSize()
  center()
  )
  (if(hIcon and not StrLen(@msgBuf))
(send hIcon:
moveTo(
    (
    / (- (- (send hDialog:nsRight) (send hDialog:nsLeft))
    (- (send hIcon:nsRight) (send hIcon:nsLeft))) 2
    )
    4
    )
)
)

(if(== -1 diagX)
= moveToX (send hDialog:nsLeft)
)(else
= moveToX diagX
)
(if(== -1 diagY)
= moveToY (send hDialog:nsTop)
)(else
= moveToY diagY
)
  (send hDialog:moveTo( moveToX moveToY ))

= oldPort GetPort()

(if(send hDialog:text)
= moveToX nwTITLE
)(else
= moveToX nwNORMAL
)
(if(newPrintDlg)
= moveToY 15
)(else
= moveToY -1
)
(send hDialog:open(moveToX moveToY))

(if(newPrintDlg)
= gOldPort GetPort()
SetPort(oldPort)
return(= gPrintDlg newPrintDlg)
)
  (if( (= hFirstEnabled (send hDialog:firstTrue(#checkState 1)))
       and (not (send hDialog:firstTrue(#checkState 2)) ) )
    (send hFirstEnabled:state(| (send hFirstEnabled:state) 2))
)
  = btnPressed (send hDialog:doit(hFirstEnabled))
  (if(== btnPressed -1)
= btnPressed 0
)

  (for (= paramCnt 0) (< paramCnt buttonCnt) (++paramCnt)
  (if(== btnPressed hButtons[paramCnt])
    = btnPressed (send btnPressed:value)
    break
)
)
  (if(not (send hDialog:theItem) )
= btnPressed 1
)
  (send hDialog:dispose())

return(btnPressed)
)

Basically, I used the existing button code and applied it to edit controls.  Let's take it for spin:

In your room:
Code: [Select]
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
        (var inp1[5], inp2[5], inp3[5], inp4[5], inp5[5], inp6[5], inp7[5], inp8[5], inp9[5], inp10[5], attributes[100])
        (super:handleEvent(pEvent))

            // you must initialize these or you will get garbage in your print
            = inp1 0
    = inp2 0
    = inp3 0
    = inp4 0
    = inp5 0
    = inp6 0
    = inp7 0
            = inp8 0
            = inp9 0
            = inp10 0
                   
            PrintMultiEdit("Input character attributes:\nStrength:\nConstitution:\nWisdom:\nDexterity:\nIntelligence:\nCharisma:\nSocial Standing:\nMagic Resistance:\nLuck:\nHealth:"
       #edit @inp1 3 100 12
       #edit @inp2 3 100
       #edit @inp3 3 100
       #edit @inp4 3 100
       #edit @inp5 3 100
       #edit @inp6 3 100
       #edit @inp7 3 100
       #edit @inp8 3 100
       #edit @inp9 3 100
       #edit @inp10 3 100
       #button "  OK  " 0
)
          )
)
 

Ok, let's go through this. 

First, the text to be displayed in the dialog.  For each edit control, we are going to be putting labels to the left of the edit controls.  The approach I took was to embed these into the normal text displayed when Print() is called, each edit control label separated by newlines.

Next, examine the new attributes for #edit.  There are two, the first (set to 100 for all edit controls in this example) is the left margin/padding for the edit control.  This is used to bump the edit controls to the right so that the edit labels don't get clobbered.  The 2nd, which only appears on the 1st #edit is the font height.  We only need this once because we aren't going to have mixed fonts within a single Print() call.  This value represents the vertical spacing we will use for spacing the edit controls apart.

Here's the result:



Let's show off the left margin attributes a bit and put in default values of zero:
Code: [Select]
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
        (var inp1[5], inp2[5], inp3[5], inp4[5], inp5[5], inp6[5], inp7[5], inp8[5], inp9[5], inp10[5], attributes[100])
        (super:handleEvent(pEvent))

            // you must initialize these or you will get garbage in your print
            StrCpy(@inp1 "0")
    StrCpy(@inp2 "0")
    StrCpy(@inp3 "0")
    StrCpy(@inp4 "0")
    StrCpy(@inp5 "0")
    StrCpy(@inp6 "0")
    StrCpy(@inp7 "0")
            StrCpy(@inp8 "0")
            StrCpy(@inp9 "0")
            StrCpy(@inp10 "0")
                   
            PrintMultiEdit("Input character attributes:\nStrength:\nConstitution:\nWisdom:\nDexterity:\nIntelligence:\nCharisma:\nSocial Standing:\nMagic Resistance:\nLuck:\nHealth:"
       #edit @inp1 3 50 12
       #edit @inp2 3 73
       #edit @inp3 3 48
       #edit @inp4 3 54
       #edit @inp5 3 67
       #edit @inp6 3 56
       #edit @inp7 3 87
       #edit @inp8 3 94
       #edit @inp9 3 31
       #edit @inp10 3 40
       #button "  OK  " 0
)
          )
)



Just for fun, let's put in some default randomized attribute values:

Code: [Select]
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
        (var inp1[5], inp2[5], inp3[5], inp4[5], inp5[5], inp6[5], inp7[5], inp8[5], inp9[5], inp10[5], attributes[100])
        (super:handleEvent(pEvent))

            // you must initialize these or you will get garbage in your print
    Format(@inp1 "%d" Random(0 20))  
            Format(@inp2 "%d" Random(0 20))
            Format(@inp3 "%d" Random(0 20))
            Format(@inp4 "%d" Random(0 20))
            Format(@inp5 "%d" Random(0 20))
            Format(@inp6 "%d" Random(0 20))
            Format(@inp7 "%d" Random(0 20))
            Format(@inp8 "%d" Random(0 20))
            Format(@inp9 "%d" Random(0 20))
            Format(@inp10 "%d" Random(0 20))
                   
            PrintMultiEdit("Input character attributes:\nStrength:\nConstitution:\nWisdom:\nDexterity:\nIntelligence:\nCharisma:\nSocial Standing:\nMagic Resistance:\nLuck:\nHealth:"
       #edit @inp1 3 50 12
       #edit @inp2 3 73
       #edit @inp3 3 48
       #edit @inp4 3 54
       #edit @inp5 3 67
       #edit @inp6 3 56
       #edit @inp7 3 87
       #edit @inp8 3 94
       #edit @inp9 3 31
       #edit @inp10 3 40
       #button "  OK  " 0
)
          )
)



I would be remiss if I didn't show that we can get these values out of our print statement - they are stored in the same input values.  This screenshot below doesn't show it, but if you change the values when in the Print() dialog, they will be reflected in the final output.

Code: [Select]
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
        (var inp1[5], inp2[5], inp3[5], inp4[5], inp5[5], inp6[5], inp7[5], inp8[5], inp9[5], inp10[5], attributes[100])
        (super:handleEvent(pEvent))

            // you must initialize these or you will get garbage in your print
    Format(@inp1 "%d" Random(0 20))  
            Format(@inp2 "%d" Random(0 20))
            Format(@inp3 "%d" Random(0 20))
            Format(@inp4 "%d" Random(0 20))
            Format(@inp5 "%d" Random(0 20))
            Format(@inp6 "%d" Random(0 20))
            Format(@inp7 "%d" Random(0 20))
            Format(@inp8 "%d" Random(0 20))
            Format(@inp9 "%d" Random(0 20))
            Format(@inp10 "%d" Random(0 20))
                   
            PrintMultiEdit("Input character attributes:\nStrength:\nConstitution:\nWisdom:\nDexterity:\nIntelligence:\nCharisma:\nSocial Standing:\nMagic Resistance:\nLuck:\nHealth:"
       #edit @inp1 3 50 12
       #edit @inp2 3 73
       #edit @inp3 3 48
       #edit @inp4 3 54
       #edit @inp5 3 67
       #edit @inp6 3 56
       #edit @inp7 3 87
       #edit @inp8 3 94
       #edit @inp9 3 31
       #edit @inp10 3 40
       #button "  OK  " 0
)

           StrCpy(@attributes "Character attributes are:")
           StrCat(@attributes " \nStrength:")
           StrCat(@attributes @inp1)
           StrCat(@attributes " \nConstitution:")
           StrCat(@attributes @inp2)
           StrCat(@attributes " \nWisdom:")
           StrCat(@attributes @inp3)
           StrCat(@attributes " \nDexterity:")
           StrCat(@attributes @inp4)
           StrCat(@attributes " \nIntelligence:")
           StrCat(@attributes @inp5)
           StrCat(@attributes " \nCharisma:")
           StrCat(@attributes @inp6)
           StrCat(@attributes " \nSocial Standing:")
           StrCat(@attributes @inp7)        
           StrCat(@attributes " \nMagic Resistance:")
           StrCat(@attributes @inp8)    
           StrCat(@attributes " \nLuck:")
           StrCat(@attributes @inp9)    
           StrCat(@attributes " \nHeath:")
           StrCat(@attributes @inp10)        

   
   Print(@attributes)
          )
)

And the final output:


One gotcha that I ran into is sometimes the formatting/spacing of a Print() call gets messed up.  One scenario is when the header text (e.g 'Input character attributes') is shorter than the edit control label + edit control.  If you run into an issue where the edit boxes are shifted up in the dialog, add leading/trailing whitespace to the text string in the Print() call to compensate.

One last thing.  The current implementation only supports up to 10 edit controls on a single print.  There really isn't more room on the screen for that, unless additional changes are made to support two columns or possibly three columns of edit controls.

14
Just noticed that the 'while' keyword isn't highlighted in the script editor as a keyword (like 'do').  Probably already fixed, but thought I'd point it out in case it got overlooked.

15
SCI Development Tools / Scene Builder
« on: October 22, 2016, 11:35:16 AM »
Here's a project I've been working on and off for the past 3 years or so.  My original intent was build a 'view library'; a collection of views to be utilized in game development.  Now it has morphed into a dynamic scene builder, where every new room the ego visits is built on the fly with views.  I created all the views from PIC resources from the KQ1 remake and I intend to continue to build up the collection from other SCI games.

From a tool perspective, it's still in it's infancy.  Right now all it does is select 15 random views and drops them into the room with some positional help (e.g. a view that was originally clipped on the left side of the room will still be placed on the left side of the room).   I need to create menu options that will allow the developer to select characteristics of what a room should consist of (outside 'sunny', outside 'swamp', inside 'cave', inside 'building', etc), background options and/or color schemes.  After a room is created, the developer will be able save off a room script generated from the rendered scene so it is reproducible in their own game.  Being able to drag a view around the screen for re-placement would be a nice feature as well.

I've attached a few screenshots of some of the better results - the hit ratio of 'good' rooms to 'bad' rooms is about 1 to 5 right now, mostly because of conflicting view types (a bed placed in a forest or stalactites placed in a meadow for example).

Pages: [1] 2 3 ... 58

SMF 2.0.11 | SMF © 2015, Simple Machines
Simple Audio Video Embedder

Page created in 0.225 seconds with 19 queries.