Magsbot Class, Session 6
Saturday April 8, 2006 5pm VRT
Magine:
g'afternoon
Belle. Thavas: g'afternoon hehe
Guri Lady: Good afternoon :)
Magine: how is everyone today?
Guri Lady: Hello, Magine. Great thank you :)
Belle. Thavas: (((Guri Lady))) :-)
Belle. Thavas: exhausted already haha
Guri Lady: ((( Belle ))))
Guri Lady: (( Magine ))
Guri Lady: Yea me too hehe
Belle. Thavas: I think I must've corrupted my class
mbot
Guri Lady: how's that?
Belle. Thavas: so I'm using the original one now
Belle. Thavas: it wasn't doing things it has done
before and should do
Belle. Thavas: So I gave up on it
Belle. Thavas: will tshoot it later
Magine: what's it not doing that it should be doing?
Belle. Thavas: it wouldn't do a survey of wiht or
without "rel"....it wouldn't follow...
Belle. Thavas: (it went through the motions of a
survey but nothing took)
Belle. Thavas: then I created a second instance for
here and the bot wouldn't follow me
Magine: well, maybe we should talk about that for a
bit....since we've already talked about buttons, which is the scheduled
topic
Belle. Thavas: ok
Belle. Thavas: I did resolve the def thing for
objinzone_rel
Magine: first check that the behavior table is turned
on, Options/Behavior Table Active
Belle. Thavas: I had edited the wrong folder
Magine: ah
Belle. Thavas: ahh..ok
Belle. Thavas: that is probably it because at some
point it got turned off...I recall seeing that
Magine: you don't want to look it it now, huh?
Chanes: hi all
Magine: hey chanes :)
Belle. Thavas: Thanks, but we can carry on to the
buttons. Hi Chanes.
Belle. Thavas: I'll set up the bot in OW and let you
know how it goes
Chanes: hi bell, magine, guri
Guri Lady: Hello, Chanes :)
Guri Lady: ((( Chanes )))
Chanes: how's everyone doing?
Magine: pretty good
PeLican: 9hi Chanes
Magine: i think we already covered the buttons, a bit
prematurely...but if there are any questions about that?
Chanes: hiya Peli
Magine: hi pelican
PeLican: hi magine
Guri Lady: (( Pelican ))
PeLican: ((GL))
Belle. Thavas: hi Pelican
PeLican: hiya belle
Magine: no questions about calling buttons as
functions?
Magine: i should have given homework, we could have
looked at that :D and the best way to learn is to do
Chanes: agreed... hehe
Chanes: i mess things up, and figure out how i did it
Magine: since i'm not quite ready to move on to
database stuff today....let's make this session a workshop then....
Magine: decide on some practical function and try to
create it
Magine: any suggestions? what would be a cool thing
to do with your bot?
Belle. Thavas: thinking....
Belle. Thavas: can I get it to give me a world count?
Belle. Thavas: rather, the number of citizens in
world?
Magine: oh sure
Belle. Thavas: or...
Belle. Thavas: something more sexy...
Belle. Thavas: let's see...
Magine: well, for a private world that is
Belle. Thavas: yes
Belle. Thavas: but let's think of something else..
Magine: for a private world, if you have a global
mode instance runnng, you can just press F3 and type @avspresent
Magine: or to see just people and not bots,
@livepresent
Belle. Thavas: ok
Magine: here's a pop quiz queston: do you know how to
start a global instance? (that's one that can see everyone in the world)
Belle. Thavas: don't you just need to have global
instance checked
Belle. Thavas: if you have CT?
PeLican: hehe
Magine: yeah
Magine: yes, you check global mode on the start
instance dialog when you create the instance
Magine: that brings to mind another quiz question:
how do you start an invisible instance?
Belle. Thavas: uncheck...auto appear
Magine: right! you just uncheck
Options/Connection/AutoAppear before starting the instance
Magine: so, any ideas for our workshop yet? anyone?
it can be something simple (better if it is)
Belle. Thavas: hehe
PeLican: Can I make gold from seawater with a magsbot?
Belle. Thavas: one thing I notice
PeLican: no, huh
Magine: pelican, yes but that was last weeks lesson
:D (on april fools day)
Belle. Thavas: when mbot shows someone arriving is it
doesn't show ip address at the same time
Belle. Thavas: can I create a function to do that?
Magine: yes
Magine: but that's pretty simple
Magine: just create a BT row with AVATARADD as the
event
Magine: and for the action, you can use the $ipof
function to get the ip from the session
Belle. Thavas: ok...
Magine: hm, well, you can if the person's firewall
doesn't hide it :D
Chanes: hehe
Belle. Thavas: right
Belle. Thavas: haha
Belle. Thavas: I'm mainly thinking of it in terms of
being one of the means for ejecting/banning particularly difficult
people
Belle. Thavas: which is rare, but one likes to have
the tools at the ready in case one has to act swiftly
Magine: you can eject by name or session too
Belle. Thavas: yes
Magine: and to add someone to the ejection list
permanently, you can use their cit number
Belle. Thavas: true
Belle. Thavas: if they are a cit
Magine: to do those things, you would use the EJECT
(for ejection by name) or EJECT_ (for ejection by session) functions
Magine: or EJECTADD to add to the permanent ejection
list
Magine: true, if you can't get their IP it's hard to
eject a tourist permanently
Magine: let me check something here, just a sec
Chanes: IPs best tho
Magine: wow, everyone here has their firewall hiding
their IP, very good :D
Draco.: really?
Magine: i couldn't get it before, i thought it might
be different if the bot checked during avataradd, but no
Belle. Thavas: that can't be right haha
Belle. Thavas: Hi Draco :)
Magine: the teacher is messing up again :P
Draco.: mornin Belle... huggs
Chanes: guess we don't trust people, eh? lol
Magine: one moment
Magine: nope, IPs are all hid
Magine: i even checked using the AW attribute
Chanes: weird
Chanes: that's weird, cuz we can get mine and Draco's
IP in Arcadia
Chanes: using bots
Magine: maybe AW (this world) hides them
Magine: maybe you need CT to get that info
Belle. Thavas: I bet that's it
Draco.: yes
Magine: makes sense
Belle. Thavas: because I can deifintely see mine with
the xg bot
Magine: (to Belle. Thavas) here??
Belle. Thavas: in ow
Magine: (to Belle. Thavas) using a cit number that
has CT?
Belle. Thavas: but here as well in my world here
Belle. Thavas: yes
Magine: (to Belle. Thavas) not here in AW world
Belle. Thavas: not in alphaworld probably
Magine: brb
PeLican: seeyachanes
Belle. Thavas: ok Chanes, take care
Magine: back
PeLican: wb'
Magine: so, no ideas? well, what is it that you
primarily want to use the bot for, generally?
PeLican: databases i hate to say
PeLican: sorry hehe
Belle. Thavas: haha yeah
Chanes: cool.. i can stick around a bit longer
Chanes: minor programming functions....
Draco.: torment visitors
Chanes: not game related tho
Magine: like what, chanes?
Chanes: D... we don't need your bots for that
Chanes: LOL
Belle. Thavas: *agrees with Draco*
Magine: hm, we could make a command to torment
visitors :D
PeLican: cool
Draco.: hee hee
Chanes: well, some ideas that I come up with to help
in the "game"... that i wouldn't have to bother Draco about.
minor things. hehe
Chanes: so, yea.. i guess game related
Chanes: LOL
Magine: any examples?
Chanes: well, i know it's been done already.. but...
Chanes: i want to learn from scratch...
Chanes: like... a mini hide and seek game that we've
done, that Duckey could track only... while I'm there...
Magine: how would that work?
Draco.: ohhh.. so Duckey can cheat and find everyone?
Chanes: not people, D.. objects.. certain ones...
like the Halloween thing we did, or similar to
Chanes: tracking of objects hidden in certain places
Chanes: within a certain radius only of duckey
Magine: ah, so just something to track how many of
the objecs that people found?
PeLican: scavenger hunt?
Chanes: yes
Chanes: just small ideas/progrmming
Chanes: i know they have those premade.. but I want
to learn how it's done and do myself..
Chanes: understand the nuts and bolts of it all
Chanes: that's just one example
Draco.: that is not necessarily an easy example
Chanes: well good... give me better understanding
then. hehe
Magine: ok, well i'll show you how to do it with
global variables...we'll save the db stuff for another lession, since
i'm being so sluggish today..
Magine: brb once more
PeLican: Magine ha a premade one that yu can actually
follow alog with....difficult but it is coherent
PeLican: I havea copy if youd like it Chanes
PeLican: (also)
Magine: yes there is the scavenger hunt script, on my
website...kind of old though
Magine: could be simplified probably
Draco.: is a good one
Magine: well we could develop one here, start simple
and add things as we go along
Magine: for today,we can just make a counter to keep
track of how many items people picked up
Belle. Thavas: ok
Chanes: ok
Magine: first we would add a row to the BT,
Magine: for the event we could put:
OBJECTCLICK @ipos["~egg",$atr[object_action]]
Magine: the @ipos function looks for one string in
another
Magine: in this case it looks for ~egg inside the
object's action
Magine: so you would put ~egg in the action field of
the objects in the world
Magine: to start out with, just for the example, we
could put
Magine: SAY $fmt["%s clicked an egg!",$avname]
Magine: for the action
Magine: hmm, any eggy objects on the AW OP?
Chanes: hmm
[Mags]: Magine clicked an egg!
[Opie]: Draco. clicked an egg!
[Mags]: Draco. clicked an egg!
Magine: we can use the red flowers here for an example
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
Magine: another way we could detect the click is, if
it was a private world and the models on the OP could be controlled,
Chanes: ok.. a little sluggish on the commands
putting in.. one sec
Chanes: but continue talking.. hehe
Magine: you could use a specific model for the eggs
PeLican: Chanes...to copy he command from the
chatline, i noticed the BT has to be closed...then open and paste
Magine: in that case you would not need to put ~egg
in the action field of each object, but for the event you could have:
Magine: OBJECTCLICK
@eq["flow12.rwx",$atr[object_model]]
[Mags]: Magine clicked an egg!
[Mags]: Draco. clicked an egg!
Magine: that would be the better method, so then you
could save some bytes to keep the Building Inspector happy
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
Magine: but suppose you wanted to have several models
as eggs?
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
Magine: any guess how we could do that?
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
Chanes: dang.. mine isn't registering
PeLican: checks desription?
Draco.: the first method?
[Opie]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Mags]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
Draco.: tag in action box?
Magine: you could use the first method, yes, but then
you have to put ~egg on all the models
Chanes: hehe, had to turn on
[Opie]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
PeLican: prefix?
Magine: or some tag
Magine: pelican, that would be one way, yes
Draco.: "list"?
PeLican: A DATABASE? hehhh
PeLican: j/k
Chanes: diff names
Magine: you could put OBJECTCLICK
@nicmp["flow",$atr[object_model],4]=0
Magine: so any model that starts with "flow" would
work
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Duckey]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
PeLican: flow being the includd in the name
Magine: however, what i was thinking was
Magine: you could check from a list of model names
[Opie]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Duckey]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
PeLican: oh like your scav hunt
[Opie]: PeLican clicked an egg!
[Mags]: Chanes clicked an egg!
[Mags]: Magine clicked an egg!
[Mags]: Chanes clicked an egg!
Chanes: ahhh, now i get it
[Mags]: Magine clicked an egg!
Magine: like OBJECTCLICK
@ind[$atr[object_model],"flow12.rwx|flow11.rwx","|"]
[Mags]: Belle. Thavas clicked an egg!
Magine: oops, darn awb made it blue
Chanes: but for say for specific sets/mods with
names... like x1, x2 x3, etc... we can just use "x" right?
[Opie]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Duckey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
Magine: the @ind function looks for a string (the
model name) within a delimited list of other strings
[Mags]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
Chanes: instead of say an ob with name xname
Magine: in this case the delimiter--that is, the
character separating the strings--is the pipe symbol |
PeLican: k
Magine: so you could add several model names to the
list
Magine: you could even define a global, like
Draco.: create a global string variable = alist of
object names, then look for word in list?
Draco.: oop
Magine: $$eggmodels="flow11.rwx|flow12.rwx
Magine: "
Magine: when your program starts, and then use
$eggmodels in the expression
PeLican: ok
PeLican: OBJECTCLICK
@ind[$atr[object_model],$eggmodels,"|"]
Belle. Thavas: brb
Magine: so anyway, you can see that there are several
ways to determine if the object being clicked is something we want to
count
Magine: there are many other ways too
Magine: that you should be able to figure out :)
Chanes: hehe
Magine: you can look at the list of string functions
to get ideas
Chanes: and for counting, that would be a DB featrue,
right?
Magine: chanes, it could be, and we will look into
that in another class session
Chanes: ok
Magine: i wanted to keep it very simple today
Chanes: :)
Chanes: no, i understand
[Duckey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
Chanes: i just watned to make sure i followed the
right thought process
[Mags]: Guri Lady clicked an egg!
[Mags]: Guri Lady clicked an egg!
[Opie]: Guri Lady clicked an egg!
[Duckey]: Guri Lady clicked an egg!
[Opie]: Guri Lady clicked an egg!
Magine: so the next thing we want to do, is keep
track of the count
Magine: basically we need a variable to store each
person's count in
Magine: we could use a db, or we could use a vlist to
store the values in
Draco.: sounds like my homework
Magine: but maybe the simplest way is to store them
in global variables based on each person's name
[Duckey]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
Chanes: ah, yea, that's what i was thinking when i
said DB
[Hervey]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
Magine: one thing about the magsbot language that i
think may be unique in programming languages (or maybe not), is that a
variable can have any kind of name
Magine: if you use the simple way of assigning
variables, like @x=12 or $z="something", then the variable name has to
begin with a letter or underscore _
Magine: and contain only letters, numbers or
underscores
Magine: but, you can also assign variables using ASN
(for local variables) or GLOBAL (for global variables)
Magine: or ASNS or GLOBALSTR for strings instead of
numbers
Magine: and if you use these commands, then the
variable can have any name at all
Magine: like GLOBAL "&&** here is one
weird variable name!!!! &$%$*"=12
Magine: or GLOBALSTR "wow this is strange!"="some
other string"
Magine: so in this case, we can use the person's name
as part of the variable name
Belle. Thavas: ahhh
Chanes: ok
Magine: we could just use the person's name by
itself, but then it might get mixed up with other variables
Magine: so in this case we can add egg_ to the front
of the name to keep them together in the variable list
Magine: so we can now put in our BT action:
Magine: SAY $fmt["%s clicked an egg!",$avname];
$vn=$cat[egg_,$avname]; global $vn=@gv_[$vn]+1
Magine: the $vn=$cat[egg_,$avname] creates a local
variable $vn containing (for example) "egg_magine"
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Opie]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Hervey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Duckey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
Magine: then the GLOBAL $vn=@gv_[$vn]+1
increments that variable each time one of the egg models is clicked on
Magine: do you see how that command works?
Magine: GLOBAL variablename=numbervalue
Magine: @gv_[$vn] gets the current value of the
egg_Magine variable
Magine: then +1 adds to it
Draco.: yes
Chanes: where do we find thatinfo then?
Magine: and the result is assigned back to the
variable again
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Opie]: egg_PeLican
[Hervey]: PeLican clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Opie]: egg_Belle. Thavas
[Hervey]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Opie]: egg_Belle. Thavas
[Hervey]: Belle. Thavas clicked an egg!
Magine: you can see those values in the global
variable list (ctrl-F3)
[Opie]: Chanes clicked an egg!
[Opie]: egg_Chanes
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
Magine: as @egg_Magine, etc.
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Duckey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
Magine: however it's not the best idea to keep the
variable list open all the time, since it slows the bot down updating it
Magine: so let's make a button to show the score
instead
Magine: let's create a new category tab for our egg
hunt game
Chanes: ok, good. i have you and I only in
there as clickers.. hehe
[Hervey]: Draco. clicked an egg!
[Mags]: Draco. clicked an egg!
[Opie]: Draco. clicked an egg!
[Mags]: Draco. clicked an egg!
[Opie]: Draco. clicked an egg!
[Hervey]: Draco. clicked an egg!
[Mags]: Draco. clicked an egg!
[Opie]: Draco. clicked an egg!
[Duckey]: Draco. clicked an egg!
[Hervey]: Draco. clicked an egg!
Chanes: LOL i knew that'd get you D
Draco.: hehe :p
Draco.: knew this mouse good for sumthin
Magine: make a "score"button, and in it, put
Magine: REPORT $pick["Egg scores","@egg_"]
Magine: the $pick function lists all the items in a
numeric list, or actually it lists any variables with the specified
prefix
Chanes: oh cool
[Hervey]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
[Duckey]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
[Mags]: Belle. Thavas clicked an egg!
[Opie]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
[Hervey]: Belle. Thavas clicked an egg!
Magine: you could put $x=$pick["Egg scores","@egg_"]
instead of the REPORT
Magine: you just need to do something with the string
that $pick returns, even though in this case we don't need to do
anything with it
Chanes: ok
Magine: just to show you how $pick works though,
leave it as REPORT... for a moment, and click one of the names when the
list appears
Magine: you will see that $pick returns that value of
the item that was selected
PeLican: cool
Magine: there are some similar functions to $pick,
you can look them up in the help....
Magine: let's add a button to clear the score
Chanes: how far out can a non global bot record..
distance/meters however you may wish to call it
Magine: hm, i forget exactly changes
Magine: *chanes, heheh sorry
Chanes: hehe
Magine: for the score-clearing button , you could put
Magine: freevars "@egg_"
Magine: clicking that will delete all the @egg_
variables
Magine: if you need to change one individually, you
could just use the ctrl-F3 variable list
Magine: but we could make a button for that, just for
the programming exercise :)
Draco.: do you ever have troubles deleting a single
list variable?
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Duckey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Mags]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Duckey]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
Magine: to do that, we first select a name from the
list
Chanes: why are we getting double statements ?
[Hervey]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Mags]: Magine clicked an egg!
PeLican: we prolly have several object click
statements in the BT
Magine: each bot here is detecting the same click
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
Magine: also, each click is detected currently, so
people can click the same "egg" multiple times
Magine: but we are going to fix that :)
Chanes: ah, good. hehe
Magine: anyone have to leave soon?
PeLican: no
Belle. Thavas: I was just about to say my good byes,
actually
Belle. Thavas: I need to leave now
Magine: oh...ok
Belle. Thavas: but I'll let this run
Magine: i'll try to remember to post the log sooner
this week
Draco.: awww... have a fun day :)
Belle. Thavas: This is good stuff, thanks, Magine!
PeLican: bye belle
Magine: so if the rest of you can stay for a bit,
Belle. Thavas: Take care all....might see some of you
in Arcadia later
Magine: before i cut to the chase and show how to
prevent multiple clicks,
Belle. Thavas: Take care Magine
Magine: you too belle :)
Chanes: bye belle
Magine: let's do that button to let you change
score's individually without using the variable list
Magine: create a "set score" button
Magine: and to start with, put
Magine: $vn=$pickv["Egg scores","@egg_"];
Magine: in it. note that is $pickv not $pick like
before
Magine: $pickv returns the variable name (like
@egg_Magine) instead of the value (like 7)
Chanes: ah, ok
PeLican: k
Magine: hehe had to think about this a moment myself
Chanes: hehe
Magine: so, you would have this in the button:
Magine: $vn=$pickv["Egg scores","@egg_"];
$vn=$tail[$vn,2];
@score=@gv_[$vn];
$new_score=$gets[$cat[$vn,"'s
Score"],"New score?",$str[@score]]
Magine: looks bad, but it makes more sense when it is
split into individual lines :D
Magine: put it in the button, save it, then open the
button again and it will be split into lines
Chanes: *eyes bulge out*
Magine: the first line is $vn=$pickv["Egg
scores","@egg_"];
Magine: we get the variable name and put it in $vn
Magine: so $vn will be like @egg_Magine
Magine: then we have to remove the "@" part so we can
use the variable name
Magine: so we do
Magine: $vn=$tail[$vn,2];
Magine: so $vn will then be just egg_Magine without
the "@" in front
Magine: the $tail function returns the "tail" of a
string, the characters past the specified location, in this case 2
Magine: does that make sense?
PeLican:
past? or starting witth?
Magine: starting with
PeLican: ok
Magine: characters in strings in magsbot are numbered
starting with 1 for the first character, etc
PeLican: ok
Magine: (in some languages like C, the first
character is 0)
PeLican: yes
Draco.: hugs K
Keshi: hugs
Magine: hi keshi
PeLican: hi keshi
Keshi: hi all i am sorry i am
late
Magine: so after we remove the @ we can use the @gv_
function to get the value of egg_Magine, like this:
Magine: @score=@gv_[$vn];
Magine: so @n will now contain the score for the
person we chose from the list
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Opie]: Keshi clicked an egg!
[Mags]: Keshi clicked an egg!
PeLican: right
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
PeLican: isee
Magine: next we use the $gets function to prompt the
user to enter a new number
Magine: $new_score=$gets[$cat[$vn,"'s Score"],"New
score?",$str[@score]]
Magine: let's break that down :)
Chanes: one sec
Magine: yes?
Chanes: why didn't it record keshi's click?
Chanes: it only got mine?
Magine: didn't it?
Chanes: no
Draco.: did she click every plant?
Chanes: don't know.. i jsut clicked the red one twice
[Hervey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Mags]: Keshi clicked an egg!
[Opie]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
Keshi: only click one plant
Chanes: mine is only score still
[Mags]: Keshi clicked an egg!
[Opie]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
Chanes: even in the original score button
[Opie]: Keshi clicked an egg!
[Mags]: Keshi clicked an egg!
[Duckey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Mags]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Hervey]: Magine clicked an egg!
[Opie]: Magine clicked an egg!
Draco.: then you win!
Chanes: there, now got here
Chanes: *hers
Magine: hervey seems to register each click twice
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
Chanes: and not picking up the yellow plant
[Hervey]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Mags]: PeLican clicked an egg!
[Hervey]: PeLican clicked an egg!
[Opie]: PeLican clicked an egg!
[Mags]: Keshi clicked an egg!
[Opie]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
[Hervey]: Keshi clicked an egg!
Magine: chanes, what do you have for the event?
Magine: in theBT?
Chanes: OBJECTCLICK @ipos["~egg",$atr[object_action]]
Magine: well there ya go :D
Chanes: ohhh
Chanes: nm
Magine: you didn't change it when we went on to other
examples
Chanes: right
Chanes: oops
Magine: if you put
Magine: OBJECTCLICK
@ind[$atr[object_model],"flow12.rwx|flow11.rwx","|"]
Magine: then it will count both flowers
[Duckey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: Draco. clicked an egg!
[Hervey]: Draco. clicked an egg!
[Hervey]: Draco. clicked an egg!
[Duckey]: Draco. clicked an egg!
[Mags]: Draco. clicked an egg!
Chanes: okeys
Chanes: DOH
Chanes: i was here and listening when we even did
that. lol
PeLican: ok, so you concatenated the user name
with 's score so
it becomes "Magine's score"
Magine: right
Magine: so the line is
Magine: $new_score=$gets[$cat[$vn,"'s Score"],"New
score?",$str[@score]];
PeLican: then bring up a new dialog box title, New
Score?
Magine: exactly, peilican
Magine: the $str[@score] will be the default value,
already in the text box when the dialog appears
Chanes: ok.. you lost me
Magine: the $gets function prompts the user for some
input
Magine: the first argument for $gets in $cat[$vn,"s
Score"]
Chanes: ah, ok
Magine: actually, that needs some adjustment, heheh
PeLican: dont they always?
Magine: make it
$new_score=$gets[$cat[$tail[$vn,6],"'s Score"],"New
score?",$str[@score]];
Magine: the $cat[$tail[$vn,6],"'s Score"] will give
the string "Magine's Score"
Magine: the $tail function here removes the @egg_ part
Magine: and the $cat function combines then Magine
with 's Score
Magine: finally the $str[@score] is the current score
that we got when we did @score=@gv_[$vn];
Magine: we are putting that into the prompt dialog as
the default value
Magine: if you have that much already entered, click
the button to see the prompt
Chanes: i get error
[Mags]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
PeLican: hmm
Chanes: $new_score=$gets[$cat[$tail[$vn,6],"'s
Score"],"New score?",$str[@score]];
Magine: yep
Magine: the whole button, so far, is
Magine: $vn=$pickv["Egg scores","@egg_"];
$vn=$tail[$vn,2];
@score=@gv_[$vn];
$new_score=$gets[$cat[$tail[$vn,6],"'s Score"],"New
score?",$str[@score]];
Chanes: ah, now it works
Magine: ok...so now we have whatever the user typed
in for the new score, stored as a string in $new_score
Magine: we need to covert that to a number before we
save it back,
Chanes: oh
Magine: but what if the used changed their mind and
clicked Cancel when they entered the number?
Chanes: that's what i did
Magine: in that case $new_score will be an empty
string
Magine: so let's add a check for that:
Magine: IF @eq[$new_score,""] { BREAK };
Magine: so if the user clicked cancel then the
function will stop at that point
Magine: ok, so now we want to convert $new_score to a
number....but if the user entered some junk that doesn't covert to a
number?
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Opie]: Chanes clicked an egg!
[Duckey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Hervey]: Chanes clicked an egg!
[Mags]: Chanes clicked an egg!
Magine: the @val function converts a string to a
number, but it will cause an error if the string is not a valid number,
Magine: so we use the TRAP clause to prevent an error
from stopping the function
Magine: TRAP {
@new_score=@val[$new_score] }{ POPUP $fmt["<%s> is not a valid
number!",$new_score]; BREAK };
Magine:
@new_score=@val[$new_score] converts the string $new_score to a number,
@new_score...unless there is an error
Magine: if there's an error, then a popup dialog
notifies the user that the string they entered, $new_score, is not a
valid number
Chanes: question? these things are for us, the
programmer, right?
Chanes: the trap and all??
Magine: ...dialog tells the user that they didn't
enter a valid number, and stops the function without an scary red error
message :D
Magine: what the TRAP does is prevent an error
message, and it prevents the function from coming to halt because of
the error
Chanes: the bot user.. okay, so not a person doing
the clicking. had to ask. cuz was getting confused
Magine: by the user in this case i mean the person
who clicked the "set score" button we're creating here
Chanes: right
PeLican: Magine, if you call up the target list and
decide to cancel at THAT point, the dialog prompts you to change a zero
score from a non-existing use
Chanes: gotcha
PeLican: user
Chanes: right, was going to ask that too Peli
Draco.: we all gonna come click duckey's buttons
after class
PeLican: heh
Magine: what the TRAP does is (1) prevents an
error message in the chat log window (in magsbot), and (2) prevents the
function from coming to a halt due to the error
PeLican: ok, the other issue is just prgramatical then
Magine: so if the user entered junk and
@new_score=@val[$new_score] causes an error
Magine: then instead of an error message, there is
the popup telling the user what went wrong
Magine: TRAP { any code at all }
{ this code happens only if there was an error in the first part }
PeLican: k
Magine: so after all, that, we can assign the new
score, with
Magine: GLOBAL $vn=@new_score
Magine: $vn remember, is the variable name like
egg_Magine and @new_score is the new value for the score
PeLican: hmm...
Magine: so you can go ahead and test your
button...try to change someone's score
PeLican: mine isnt taking the new score
Chanes: mine either
Magine: maybethe example would be more clear if i
chose better variable names...
Magine: you added the GLOBAL $vn=@new_score part?
PeLican: yes
Magine: remember you need a ; between each command
PeLican: AH..YES
PeLican: oops
Chanes: oh, i just put on new line.. still need ; at
previous end?
Magine: yep
Magine: you need a ; after each line except the last
one
PeLican: yep, that was it
Chanes: grrrr
PeLican: Keshi, you have high score btw
PeLican: :)
Draco.: WTG K!
PeLican: hehe
Chanes: $vn=$pickv["Egg scores","@egg_"];
Chanes: oop
PeLican: I must go...I'll leave Opie
Chanes: crud.. i have to leave now.. but will park
and record.... thanks magine for this.. gives me much
better understanding
PeLican: bye all
Magine: i think we can call it here
PeLican: ok
Magine: next time we can talk about how to prevent
multiple clicks
Chanes: hehe
Chanes: that NEVER happens
Chanes: LOL
PeLican: seeya next week..thanks Magine
Magine: bye peli :)
Chanes: ok.. bye all.... thanks again Magine!!!
Draco.: ty Magine.. have a fun day
Magine: i'll change all the variable names in the
class log so it will make more sense, heheh
Magine: bye all