saving scores/numbers to accounts

  • Thread starter Thread starter bilun
  • Start date Start date
B

bilun

Guest
Hey, i've been messing around with the warcraft 3 editor lately and while i'm sure it's very complicated i was wondering how you save a score to an account(for example the way you can save your score in Dark Deeds/other similar games)

i'd appreciate it if anyone could give me a good idea on how to accomplish this

thanks!
 
There tutorials and such on this site just look around, probrably in tutorial repository... but the base idea is just to convert 1 to a 2 to c 3 to h etc... just mix it up so ppl dont know and add some anti-cheat stuff somewhere... I never used one though :rolleyes:
 
Ok It is kinda complicated, but not too much so. Basically the way codes work is they don't actually save the information, they just take a few strings, in our case a name and a number, and encrypts it. then when the player types the name in, it decrypts it.

First, to encrypt the code, we will use a string array of size 9. set the code [0] to be abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()-_=+[{]}\|;:'",<.>/? (just copy paste this) then set each array slot to be a different random set of numbers and letters. make sure not to repeat a letter or number, and leave the `~!@#$%^&*()-_=+[{]}\|;:'",<.>/? as it is.
Code:
Set Codes
    Events
        Map initialization
    Conditions
    Actions
        Set Code[0] = abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[1] = qw1ertyu29iopas4dfg8hjkl3z7xc0vb56nm`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[2] = za6qwsx5cd0e7rfv4bg3t8yhnm2jui9kl1op`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[3] = qaz3w1sx8edc6rfvtgb2974yhn5ujm0ikolp`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[4] = pqo5wieu93rytl6ak2sjdhf04gz7mx1n8cbv`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[5] = plkon5m0jiuh49bv18c6xzasdf37gy2trewq`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[6] = mzx2n5bcv8akjsh63dg9fqp7o0wei41uryt`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[7] = qaz2e5dc0tgb69ujmo7lws3xrf4vy8h1nikp`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[8] = g4fjdk03sla95yturi8eo2wpq6bvn7c1hmxz`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
        Set Code[9] = po5iuy0e1wq946astrdfg3hjk7lm2nb8vcxz`~!@#$%^&*()-_=+[{]}\|;:'",<.>/?
now we have a basis for our codes. now we need to make a trigger to use them. It will take the string we are saving, and set each letter/number to be the codeset's counterpart. for example

a=g
b=4
c=y
d=e
etc...

To do this, we will make a set of 2 loops, one inside the other, to check each letter/number of the string and change it to the codset. now you may have been wondering why we made 9 codesets? well we will have 1 number in front of the code that will not be encrypted, and will refrence to the codeset we used. to start off, lets set the string so we can encrypt it.

First set a variable called CodeSet to a random number between 1 and 9, this will be the set we use. now we make another string array called SaveCode sized to 12, or however many players you have. Set the string to ((string(codeset)) + ( Substring (player name of (triggering player)), 1, 3) + (string(Score)))) This sets the first number to be the random number picked, the code set we are using, and the second third and fourth letters to be the first 3 letters of the players name (so people cant steal it). then it sets the last numbers to be (score) whish is an integer variable i made that represents the score the player has (you set this however you normaly do, just make sure its updated when they save). Now the code will read something like this:

5Age923

the last numbers could be anything from 2 to 4950 so make sure it's at the end so we can read it accuratly. your trigger should look something like this:
Code:
Save
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
        Player - Player 5 (Yellow) types a chat message containing -save as An exact match
        Player - Player 6 (Orange) types a chat message containing -save as An exact match
        Player - Player 7 (Green) types a chat message containing -save as An exact match
        Player - Player 8 (Pink) types a chat message containing -save as An exact match
        Player - Player 9 (Gray) types a chat message containing -save as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
        Player - Player 12 (Brown) types a chat message containing -save as An exact match
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        Set CodeSet = (Random integer number between 1 and 9)
        Set SaveCode[PlayerNum] = ((String(CodeSet)) + ((Substring((Name of (Triggering player)), 1, 3)) + (String(Score))))
(note i set the player number to be a variable for easy use)

Now to encrypt it. First we have to put the string into an array, one letter/number per array slot, make sure the size is bigger than you will need, so we dont run out of room. Now to change each letter/number to its code counterpart, we make a double-loop, that is a loop inside a loop. make the first one go from 2 to (string length of (SaveCode[PlayerNum])) so that it will set all the number/letters starting with 2 (skipping the codeset num) and endin with however long the save code is. then make another loop that goes from 1 to 68, the length of our codeset strings.

Now make an If - Then - Else and in the condition check if Encrypt(integer A) is equal to (Substring(Code[0], (Integer B), (Integer B))). that will just check the slot its on and see if the number/letter is the same as the number/letter of each one in the standard codeset, [0]. Now for out Then actions we use Set Encrypt[(Integer A)] = (Substring(Code[CodeSet], (Integer B), (Integer B))). this sets the array number we are on to equal the letter matched, except on the codeset, so it will be different. now we have out encrypted string, but its scattered in the array, so lets put it back together again by setting SaveCode to be Encrypt[1] + encrypt[2] + encrypt[3] etc on up to however big you code can be. and there we have it! a fully encrypted save code, ready for display! make sure the code displayed for a fair amount of time, so the player can write it down, and for easy remembering set it all to caps. if you code gets fairly long consider putting -'s every once in a while to make it easier to read. now your trigger should look something like this:
Code:
Save
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
        Player - Player 5 (Yellow) types a chat message containing -save as An exact match
        Player - Player 6 (Orange) types a chat message containing -save as An exact match
        Player - Player 7 (Green) types a chat message containing -save as An exact match
        Player - Player 8 (Pink) types a chat message containing -save as An exact match
        Player - Player 9 (Gray) types a chat message containing -save as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
        Player - Player 12 (Brown) types a chat message containing -save as An exact match
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        Set CodeSet = 0
        Set SaveCode[PlayerNum] = <Empty String>
        For each (Integer A) from 1 to 20, do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = <Empty String>
                Set IsCryptic[(Integer A)] = False
        Set CodeSet = (Random integer number between 1 and 9)
        Set SaveCode[PlayerNum] = ((String(CodeSet)) + ((Substring((String((Name of (Player(PlayerNum)))) as Lower case), 1, 3)) + (String(Score))))
        For each (Integer A) from 1 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = (Substring(SaveCode[PlayerNum], (Integer A), (Integer A)))
        For each (Integer A) from 2 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                For each (Integer B) from 0 to 68, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Encrypt[(Integer A)] Equal to (Substring(Code[0], (Integer B), (Integer B)))
                                IsCryptic[(Integer A)] Equal to False
                            Then - Actions
                                Set Encrypt[(Integer A)] = (Substring(Code[CodeSet], (Integer B), (Integer B)))
                                Set IsCryptic[(Integer A)] = True
                            Else - Actions
        Set SaveCode[PlayerNum] = (Encrypt[1] + (Encrypt[2] + (Encrypt[3] + (Encrypt[4] + (Encrypt[5] + (Encrypt[6] + (Encrypt[7] + (Encrypt[8] + (Encrypt[9] + (Encrypt[10] + (Encrypt[11] + (Encrypt[12] + (Encrypt[13] + (Encrypt[14] + (Encrypt[15] + (Encrypt[16] + (Encrypt[17] + (Encrypt[18] 
        Game - Display to (Player(PlayerNum)), at offset (0.00, 0.00) for 600.00 seconds the text: (String(SaveCode[PlayerNum]) as Upper case)

Now to Decrypt it, we do the same thing, but backwards! it should look like this:
Code:
Load
    Events
        Player - Player 1 (Red) types a chat message containing -load as A substring
        Player - Player 2 (Blue) types a chat message containing -load as A substring
        Player - Player 3 (Teal) types a chat message containing -load as A substring
        Player - Player 4 (Purple) types a chat message containing -load as A substring
        Player - Player 5 (Yellow) types a chat message containing -load as A substring
        Player - Player 6 (Orange) types a chat message containing -load as A substring
        Player - Player 7 (Green) types a chat message containing -load as A substring
        Player - Player 8 (Pink) types a chat message containing -load as A substring
        Player - Player 9 (Gray) types a chat message containing -load as A substring
        Player - Player 10 (Light Blue) types a chat message containing -load as A substring
        Player - Player 11 (Dark Green) types a chat message containing -load as A substring
        Player - Player 12 (Brown) types a chat message containing -load as A substring
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        For each (Integer A) from 1 to 20, do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = <Empty String>
                Set IsCryptic[(Integer A)] = False
        Set CodeSet = 0
        Set SaveCode[PlayerNum] = <Empty String>
        Set SaveCode[PlayerNum] = (Substring((String((Entered chat string)) as Lower case), 7, (Length of (Entered chat string))))
        Set CodeSet = (Integer((Substring(SaveCode[PlayerNum], 1, 1))))
        For each (Integer A) from 1 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = (Substring(SaveCode[PlayerNum], (Integer A), (Integer A)))
        For each (Integer A) from 2 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                For each (Integer B) from 0 to 68, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Encrypt[(Integer A)] Equal to (Substring(Code[CodeSet], (Integer B), (Integer B)))
                                IsCryptic[(Integer A)] Equal to False
                            Then - Actions
                                Set Encrypt[(Integer A)] = (Substring(Code[0], (Integer B), (Integer B)))
                                Set IsCryptic[(Integer A)] = True
                            Else - Actions
        Set SaveCode[PlayerNum] = (Encrypt[1] + (Encrypt[2] + (Encrypt[3] + (Encrypt[4] + (Encrypt[5] + (Encrypt[6] + (Encrypt[7] + (Encrypt[8] + (Encrypt[9] + (Encrypt[10] + (Encrypt[11] + (Encrypt[12] + (Encrypt[13] + (Encrypt[14] + (Encrypt[15] + (Encrypt[16] + (Encrypt[17] + (Encrypt[18]

Now we have the unencrypted code set up, but instead of showing it to the player, we will check the player's name and if it's right set his points to the saved value. make the If - Then - Else , and in the conditions make an action to check if the first 3 letters (substring 1,3) of the players name are the same as the letters that were saved(substring 2,4). In the then actions set the variable score to equal the number in the code (substring 5,(string length). And finnaly in the else actions display a message that tells the player his code was invalid, or if you want tell everyone he was trying to steal a code:P) now the load should look like this:
Code:
Load
    Events
        Player - Player 1 (Red) types a chat message containing -load as A substring
        Player - Player 2 (Blue) types a chat message containing -load as A substring
        Player - Player 3 (Teal) types a chat message containing -load as A substring
        Player - Player 4 (Purple) types a chat message containing -load as A substring
        Player - Player 5 (Yellow) types a chat message containing -load as A substring
        Player - Player 6 (Orange) types a chat message containing -load as A substring
        Player - Player 7 (Green) types a chat message containing -load as A substring
        Player - Player 8 (Pink) types a chat message containing -load as A substring
        Player - Player 9 (Gray) types a chat message containing -load as A substring
        Player - Player 10 (Light Blue) types a chat message containing -load as A substring
        Player - Player 11 (Dark Green) types a chat message containing -load as A substring
        Player - Player 12 (Brown) types a chat message containing -load as A substring
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        For each (Integer A) from 1 to 20, do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = <Empty String>
                Set IsCryptic[(Integer A)] = False
        Set CodeSet = 0
        Set SaveCode[PlayerNum] = <Empty String>
        Set SaveCode[PlayerNum] = (Substring((String((Entered chat string)) as Lower case), 7, (Length of (Entered chat string))))
        Set CodeSet = (Integer((Substring(SaveCode[PlayerNum], 1, 1))))
        For each (Integer A) from 1 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                Set Encrypt[(Integer A)] = (Substring(SaveCode[PlayerNum], (Integer A), (Integer A)))
        For each (Integer A) from 2 to (Length of SaveCode[PlayerNum]), do (Actions)
            Loop - Actions
                For each (Integer B) from 0 to 68, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Encrypt[(Integer A)] Equal to (Substring(Code[[B]CodeSet[/B]], (Integer B), (Integer B)))
                                IsCryptic[(Integer A)] Equal to False
                            Then - Actions
                                Set Encrypt[(Integer A)] = (Substring(Code[0], (Integer B), (Integer B)))
                                Set IsCryptic[(Integer A)] = True
                            Else - Actions
        Set SaveCode[PlayerNum] = (Encrypt[1] + (Encrypt[2] + (Encrypt[3] + (Encrypt[4] + (Encrypt[5] + (Encrypt[6] + (Encrypt[7] + (Encrypt[8] + (Encrypt[9] + (Encrypt[10] + (Encrypt[11] + (Encrypt[12] + (Encrypt[13] + (Encrypt[14] + (Encrypt[15] + (Encrypt[16] + (Encrypt[17] + (Encrypt[18] 
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Substring((String((Name of (Player(PlayerNum)))) as Lower case), 1, 3)) Equal to (Substring(SaveCode[PlayerNum], 2, 4))
            Then - Actions
                Set Score = (Integer((Substring(SaveCode[PlayerNum], 5, (Length of SaveCode[PlayerNum])))))
            Else - Actions
                Game - Display to (Player group((Player(PlayerNum)))) the text: Invalid Code
If theres a part I should go over more clearly, please say as i may submit this to the tutorial thread.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Also, in the last template there was a seperation between sticky threads and regular threads in the forum
  • Ghan Ghan:
    Not sure. It's probably part of a cron job.
  • The Helper The Helper:
    Hey Ghan, whatever cron job its part of its not running its been the same for days. If it does not work can we remove it?
  • The Helper The Helper:
    LOL! A tweak job!
  • The Helper The Helper:
    this is the fix I get from that yeah this is hard to control. disabling bots is pretty much necessary as ai and other bots would push really old threads to the top. reduce weight of view count. disable guest view tracking if you really want to push active threads to the top. a bit of tinkering for a few days with the weights and other settings should get you a decent trending widget box.
  • Ghan Ghan:
    I changed the settings a bit.
  • Ghan Ghan:
    Narrowed it to 7 days for the half-life and set views to 0 weight.
  • The Helper The Helper:
    I dont think Trending would work for this forum it would be better to just have the last 5 posts from anywhere
  • Ghan Ghan:
    Probably will have to give it some time to update.
  • Ghan Ghan:
    I'm guessing it is not retroactive.
  • Ghan Ghan:
    Next on the punch list: Update the server to Ubuntu 24.04.
  • The Helper The Helper:
    Mad Lads is new I see it displays original post date
  • The Helper The Helper:
    as long as it changes it is good - it is good now it updated and its new stuff
  • The Helper The Helper:
    One thing I have noticed and I dont know if it is by design but like 1 out of 3 times I come to the site the Anubis screen just hangs open, if I refresh it will go away but sometimes it hangs
  • Ghan Ghan:
    I've seen that as well.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic weekend!

The Helper Discord

Staff online

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top