The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
emu48 append to list issue
03-21-2022, 11:03 PM (This post was last modified: 03-22-2022 09:44 PM by rickster.)
Post: #1
emu48 append to list issue
I'm working on a program to generate characters for a role-playing game. I am having trouble with '+' used to append an item to a list:
Code:

@ HP 48GX simulator
@ XGEN2 -- do the crunch for A/H Chaosium Runequest 3e characters

@ relevant parts of the program
« 
INI$LOG    @ initialize the logger function
" →X XGEN2" LOGGIT
   @ append to LOG$S
LOAD$$    @ initialize data structures
CLFX
   @ clear flags #1-#7
DO 
  SP$PICK
   @ choose species from list, execute corresponding XX$$ routine setting species name, average characteristic values, mov stat,  base age, and gender, and set flag #i if average characteristic #i is e.g. 10.5
UNTIL 1 ==
END 
DUP 'CHRXCX' STO
   @ save a copy of this vector, and pass a copy to next routines
BUMPX    @ if flag #i set, add 1 to characteristic #i half the time
ADJX    @ randomize each charax +2D4-4 -- definitely not canon!
EDITX    @ edit the randomized set to taste
OBJ→ DROP   @ put  vector elements in stack, drop count from level 1 of strack

   @ start a local variable block with values taken from stack
←str ←con ←siz ←int ←pow

←dex ←app ←mov ←age ←gnr

  « ATTRS 'CHRXAT' STO    @ calc attributes (hit points, strike rank,...), and save a vector thereof
     SCMS 'CHRXSC' STO
   @ calc Skills  Category Modifiers and save a vector thereof
     DO$PREXP 'CHRXPE' STO
   @ handle previous experience for this character (not implemented)
  »    @ end local block
"X→ XGEN2" LOGGIT

LOG$S
   @ show the log
»
'XGEN2' STO


@ $$EDITX -- set parameters for INFORM in EDITX
« 

  "EDIT CHARAX"    @ title 
  { { "STR:" "" 0 } { "CON:" "" 0 } { "SIZ:" "" 0 } 
    { "INT:" "" 0 } { "POW:" "" 0 } { "DEX:" "" 0 } 
    { "APP:" "" 0 } { "MOV:" "ms" 13 } { } 
    { "age:" "" 0 } { } 
    { "gnr:" "m,f,..." 2 } }     @ field specs
  { 3 4 }
   @ layout
  { }    @ reset values

CHRXCX 1 →LIST +
   @ append initial values as a list, as 5th item in the list
»
'$$EDITX' STO

@ EDITX --- run the input form, return a vector on the stack
«
"  ->X EDITX" LOGGIT
DO 
  $$EDITX OBJ→ DROP
  @ set the 5 values from $$EDITX on the stack for the input form
  INFORM
UNTIL 1 ==
   @ consume Boolean from stack
END    @ return the edited values as a vector
"  X-> EDITX" LOGGIT
»
'EDITX' STO

When I run XGEN2, it stalls at INFORM in EDITX: the "$$EDITX" routine apparently fails to add CHRXCX as
the 5th element of the parameter-list. (CHRXCX has a value.) When I run "$$EDITX" on its own, however, it does add the list. And when I run EDITX on its own, it displays the input form correctly!
I am completely puzzled by this behaviour. Any ideas? Thanks in advance...

Charles? He was my grandfather. --Oh, *that* Charles. We share a common ancestor.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
emu48 append to list issue - rickster - 03-21-2022 11:03 PM
RE: emu48 append to list issue - DavidM - 03-22-2022, 01:05 PM
RE: emu48 append to list issue - rickster - 03-22-2022, 02:44 PM



User(s) browsing this thread: 1 Guest(s)