Author Topic: My first game  (Read 48066 times)

0 Members and 6 Guests are viewing this topic.

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #75 on: May 27, 2014, 09:00:25 pm »
I have seen other people's source code but I can't get it to work.
On my tests I do:

Code: [Select]
.SAVE
getCalc("appvarTest")->M
repeat getkey(15)
output(1,1,M dec,i) //basically output m
if getkey(10)
M+1->M
end
end
M->{getCalc("appvarTest")}


Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: My first game
« Reply #76 on: May 28, 2014, 01:35:51 am »
You would need curly brackets around the first getCalc command. Other than that it should be good.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: My first game
« Reply #77 on: May 28, 2014, 08:14:46 am »
If the appvar is in ram, that is

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: My first game
« Reply #78 on: May 28, 2014, 08:24:39 am »
It it's archived, it will return an NP so it's not an issue if you add a check first.

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #79 on: May 29, 2014, 03:37:53 pm »
So i did this:
Code: [Select]
.SAVE
{getCalc("appvarTest")}->M
repeat getkey(15)
output(1,1,M dec,i) //basically output m
if getkey(10)
M+1->M
end
end
M->{getCalc("appvarTest")}
and it still didn't work... help?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: My first game
« Reply #80 on: May 29, 2014, 03:58:52 pm »
Wait. How are you typing the appv token ? It's supposed to be 2nd+8.
Also, make sure your variable exists. If it doesn't, you can't write to it.

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #81 on: May 29, 2014, 10:04:22 pm »

so I did this:
Code: [Select]
.SAVE
!if {getCalc("appvarTest")}->M
->{getCalc("appvarTest")}
end
repeat getkey(15)output(1,1,M dec,i) //basically output m
if getkey(10)
M+1->M
end
end
M->{getCalc("appvarTest")}
And when I check the appvar list, it isn't there. and I also use 2nd 8
Also, I am adding a new class called mage and I am adding skills that you can use.
« Last Edit: May 29, 2014, 10:12:24 pm by Omegaxis213 »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: My first game
« Reply #82 on: May 30, 2014, 04:31:48 am »
then you have to create it first.
Just make a seperate prog like this to create it:
getCalc("appvTest",2)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: My first game
« Reply #83 on: May 30, 2014, 09:04:26 am »
then you have to create it first.
Just make a seperate prog like this to create it:
getCalc("appvTest",2)

Why would you need a separate program to create it? You can simply create it if it doesn't already exist from your main program logic, like:

Code: [Select]
"appvTest"→Str0
!If GetCalc(Str0)
  GetCalc(Str0,2)
End
→V

Then, you'd have a reference to the appvar in the variable V. Alternatively, a solution with a bit more robustness, which works if the appvar is archived and handles the case in which allocation failed:

Code: [Select]
"appvTest"→Str0
UnArchive Str0
!If GetCalc(Str0)
  !If GetCalc(Str0,2)
    .Failed to create appvar, handle error somehow
  End
End
→V

Then you'd probably want to Archive Str0 before your program ends so it doesn't get lost in a random RAM clear.

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #84 on: May 30, 2014, 06:02:12 pm »
can you post a source code because it still doesn't work...

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: My first game
« Reply #85 on: May 31, 2014, 03:29:57 am »
That's what he did ?

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #86 on: May 31, 2014, 03:22:31 pm »
I tried and it doesn't work, but can one of you add a saving mechanism to my program once I am done and uploaded the source code?
« Last Edit: May 31, 2014, 03:36:38 pm by Omegaxis213 »

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: My first game
« Reply #87 on: June 03, 2014, 09:20:21 pm »
I made the game so that once you click and release the button, you attack instead of holding the button, but if you hold the button for a while, then release you do a power attack which does double damage and is quicker.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: My first game
« Reply #88 on: June 04, 2014, 02:14:45 am »
Nice. :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: My first game
« Reply #89 on: June 04, 2014, 12:03:39 pm »
Another alternative to appvars would be self-modifying code, but then the game cannot be an app nor a nostub program. Else there's the old school password save system trick, which is hard to make secure.