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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a form to submit the score

Status
Not open for further replies.

squiggles121

Technical User
Aug 17, 2006
14
GB
I've created a whack a mole game with a counter that adds up how many moles u manage to hit in a certain time limit. I have then created a form with the idea that the user can then type in their name and email address (the score will already be carried on from previous page) and submit their score. I've read up on how to send emails and similar and the information has to be put as a global DataList so it can be sent as one string (hopefully this is right!?)...however as you do not type the score into the field i can't get it to be part of this list!

Any ideas?
 
Thanks for the quick reply! Both the datalist and the score are global variables but i think the problem is to do with the 'name' and 'email' being typed into fields by the user and the score being carried on from before.

This is the code attached to the fields (I adapted it from a tutorial on the Internet so its possible it may be totally wrong!):

property pValidChars
property pDataField
property pMem,

global gDataList,

on getPropertyDescriptionList me

dataFieldsList = [#name, #emailAddress]

set pdlist to [:]

addprop pdlist, #pValidChars, [#comment:"Valid chars", #format:#string, #default:"abcdefghijklmnopqrstuvwxyz 0123456789 @."]
addprop pdlist, #pDataField, [#comment: "Which data?", #format:#symbol, #default: #firstname, #range: dataFieldsList]

return pdlist
end


on beginSprite me

pMem = sprite(me.spriteNum).member
pMem.text = ""

end

on keyDown me
if the key = BACKSPACE then
pass
else if pValidChars contains the key then
pass
end if
end


on storeData me
if voidP(gDataList) then
gDataList = [:]
end if

setaProp gDataList, pDataField, pMem.text,
end


i've tried adding gScore into various places but it just returns an error message.
At the moment when you click the 'submit' button you get

gDataList= [#name: "abcd", #EmailAddress: "abcd ", #score: "", <Void>: <Void>]

and as you can see it wont pick up the score!!
I've played games online where you can submit the score so it must be possible!!!!!
 
ah thank you so much that works great!

The only thing is it displays the score as zero all the time as it must be reading what gScore equals at the beginning of the movie.

Is it possible to say something similar to

gDataList[#score] = gScore when time = 300 seconds

or gDataList[#score] = gScore when pWin=1 ??


As you can tell i'm quite new to lingo and am not sure how to phrase things yet!!

thanks again! :)
 
I've put

gDataList[#score] = gScore

in the on beginSprite handler in the above code as this seemed like the most sensible place

is that right?
 
yay it works! :)

I had a look back through all my scripts and saw in some of them i had pScore and in some i had gScore!!!!

Now all I have to do is work out how to send it!

Thank you so much. Have a nice day :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top