×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

creating a form to submit the score

creating a form to submit the score

creating a form to submit the score

(OP)
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?

RE: creating a form to submit the score

If your score is stored in a global variable you can just add it to your global DataList, can't you?

Kenneth Kawamoto
www.materiaprima.co.uk

RE: creating a form to submit the score

(OP)
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!!!!!

RE: creating a form to submit the score

Say you have your score in global gScore. All you need to do is:

gDataList[#score] = gScore

Kenneth Kawamoto
www.materiaprima.co.uk

RE: creating a form to submit the score

(OP)
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! :)

RE: creating a form to submit the score

That doesn't sound quite right. Aren't you displaying the final score on screen? That score should be gScore.

Kenneth Kawamoto
www.materiaprima.co.uk

RE: creating a form to submit the score

(OP)
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?

RE: creating a form to submit the score

Possibly, but make sure you actually have gDataList defined at that point.

Kenneth Kawamoto
www.materiaprima.co.uk

RE: creating a form to submit the score

(OP)
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  :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close