Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

still struggling with my script aND LINGO HELP!

Status
Not open for further replies.

Igotpower

Technical User
Apr 29, 2004
2
GB
All i would like my script to do is add points and subtract points as the user clicks on each member and for them to see whether they are losing and to play badluck music when they lose a point or success when they win . This script i am using so far is below , i am trying books and websites to sort out my problem but to no avail * back to the drawing board* My due date for this is monday any help will be appreciated
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

property points, pointsForThisSprite

on mouseUp?
points = points + pointsForThisSprite
alert("You scored "&pointsForThisSprite&" points!")
end

on getPropertyDescriptionList me
pdlist = [:]
pdef = [#comment: "Number of points for this sprite",#format:#integer,#default:0]
addprop pdlist,#pointsForThisSprite,pdef
return pdlist
end



on mousedown
set points = 100
if points < -10 then puppetSound(1,member("BadLuckSound"))



if points < +10 then puppetSound(1,member("SuccessSound"))

end if
end
 
This is a cleaned-up version of the first part of your script:
--
global points
property pointsForThisSprite

on mouseUp me
if integerP(points) < 1 then points = 0
points = points + pointsForThisSprite
alert("You scored" && pointsForThisSprite && "points!")
alert("Your total score is" && points && "points")
end mouseUp

on getPropertyDescriptionList me
pdlist = [:]
pdef = [#comment:"Number of points for this sprite", #format:#integer, #default:0]
pdlist.addprop(#pointsForThisSprite, pdef)
return pdlist
end
--[/color blue]
This will add (or subtract) points, which you define in the Behavior property window, each time the mouse is clicked. It alerts the points scored and the total score.

If I understood you correctly, you would have number of buttons with various points assigned (the points can be negative number) and they will change the overall score when clicked. Therefore the variable "points" should be Global.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top