Ok Hello all,
I got a small problem I'm trying to set up a random event situation for a
game. The problem is that I need to store in the random list a name of
another property list, so that I can give a bonus. The random event list is
called on the PrepareMovie handler. Ok here is the gRandomEvent list:
*LINGO**********************************************************************
*****************************
on initgRandomEvents
gRandomEvent = [:]
gRandomEvent.addprop(#commisioned,[#class: 1, #occ: 1,
#desc:"commsionDesc",#rewards:["gplayer[13]",300]])
gRandomEvent.addprop(#design,[#class:1, #occ: 1, #desc:"designDesc",
#rewards:["gplayer[13]",400]])
gRandomEvent.addprop(#innerself, [#class:1, #occ: 2, #desc: "innerDesc",
#rewards:["gskillList[49][2]",1]])
gRandomEvent.addprop(#spirit, [#class:1, #occ: 2, #desc: "spiritDesc",
#rewards:["gskillList[49][2]",2]])
gRandomEvent.addprop(#official, [#class:1, #occ: 3, #desc: "officialDesc",
#rewards:["gplayer[13]",300]])
gRandomEvent.addprop(#plague, [#class:1, #occ: 3, #desc: "plagueDesc",
#rewards:["gSkillList[35][2]",2]])
gRandomEvent.addprop(#cure, [#class:1, #occ: 3, #desc: "cureDesc",
#rewards:["gSkillList[34][2]",1]])
gRandomEvent.addprop(#conversion, [#class:1, #occ: 4, #desc:
"conversionDesc", #rewards:["gSkillList[41][2]",1]])
gRandomEvent.addprop(#found, [#class:1, #occ: 5, #desc: "foundDesc",
#rewards:["gplayer[13]",500]])
gRandomEvent.addprop(#built, [#class:1, #occ: 5, #desc: "builtDesc",
#rewards:["gSkillList[29][2]",1]])
gRandomEvent.addprop(#research, [#class:1, #occ: 5, #desc: "researchDesc",
#rewards:["gStats[1][1]",1]])
return gRandomEvent
end
*END
LINGO***********************************************************************
******************************
This list stores a couple of things, but the one I need help with is the
Rewards property. The first value is the list that needs to be updated with
the second list in the Rewards property. ex. gRandomEvent[11][4][1] is added
to gRandomEvent[11][4][2]. My question is how do I update the reward list
with the new value? Here is the frameScript that I use to update the value:
*LINGO**********************************************************************
*********************************
global gRandomEvent,gStats,gPlayer
property randEvent,pReward,mylist,pOldValue
on beginsprite
mylist = [:]
--clear the info boxes
put "" into member("eventdesc")
put "" into member("status")
--get a random event based on current class
repeat with i = 1 to gRandomEvent.count
if gPlayer[6][7] = gRandomEvent[i][2] then
mylist.addProp(symbol("event"&i), gRandomEvent[i])--.duplicate())
end if
end repeat
randEvent = random(mylist.count)
put "Random Event" into member "pagetitle"
put member(myList[randEvent][3]).text into member("eventdesc")
pOldValue = value(mylist[randEvent][4][1])
pOldValue = pOldValue + mylist[randEvent][4][2]
put pOldValue
put myList into member("status")
end
on exitframe
go to the frame
end
*END
LINGO***********************************************************************
***************
This script makes a new list (myList, Great title right?) that just contains
the random events for the players occupation. Ok so now I have a new value
(pOldValue) that contains the number that I want for the rewards list. How
do I take the name of that list and update it with the pOldValue?
Thanks
Grant Balke
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]