Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

SetScore question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> SetScore question Page: [1]
Login
Message << Older Topic   Newer Topic >>
SetScore question - 11/30/2019 3:57:08 PM   
Gunner98

 

Posts: 5089
Joined: 4/29/2005
From: The Great White North!
Status: offline
This is a simple one but I'm just getting back into Lua and am drawing a blank. Trying to reset a score to '0'

a=ScenEdit_GetScore("Marker")
ScenEdit_SetScore("Marker", (a=0))

Getting: ERROR: [string "Console"]:2: ')' expected near '='

I've tried it a half dozen ways and there is a variation on this.

There may also be an error in the documentation at commandlua.github.io/

Shouldn't the example read ScenEdit_SetScore...

I've tried it with just this line as well, no luck.

Thanks in advance






Attachment (1)

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Post #: 1
RE: SetScore question - 11/30/2019 6:12:14 PM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
ScenEdit_SetScore("Marker", 0)

no need to set it to a variable with the a= bit.
If you were retrieving the score then setting it = to a variable would make it so you could do stuff with it. But to just set it to zero there is no need for that.

Yes, the docs examples is not correct.

(in reply to Gunner98)
Post #: 2
RE: SetScore question - 12/4/2019 9:53:53 AM   
Gunner98

 

Posts: 5089
Joined: 4/29/2005
From: The Great White North!
Status: offline
Thanks Whicker

EDIT: OK sorted that out - when I string two commands together though I get another error

ScenEdit_SetScore("Marker", 0)
ScenEdit_SetScore("Marker 2", 0)

ERROR: [string "Console"]:2: unexpected symbol near ''No reason given''

Is there something I need to put between the two? Didn't think so..

Tx

< Message edited by Gunner98 -- 12/4/2019 9:59:22 AM >


_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to Whicker)
Post #: 3
RE: SetScore question - 12/5/2019 12:51:28 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
hmm, not sure. You should not need anything else. Does the second one work by itself? I would re-write it and see if that works, if you copy + paste sometimes you pick up illegal characters.

(in reply to Gunner98)
Post #: 4
RE: SetScore question - 12/5/2019 11:43:56 PM   
Gunner98

 

Posts: 5089
Joined: 4/29/2005
From: The Great White North!
Status: offline
Yeah that's what I thought but strangely alone they work, together they don't. I can work around it - thanks for the help.

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to Whicker)
Post #: 5
RE: SetScore question - 12/6/2019 4:01:38 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
hmm, seems like anything you do after the first SetScore results in an error. There is a 3rd argument that function accepts for the reason, I think it is optional but don't see anything expressly saying that. But it does the same thing with a reason.
It seems like it may work ok even with the error but I am not positive - I ran a quick test scen and it seemed to work, in the game.

(in reply to Gunner98)
Post #: 6
RE: SetScore question - 12/8/2019 2:11:45 AM   
michaelm75au


Posts: 13200
Joined: 5/5/2001
From: Melbourne, Australia
Status: online
Reason is required for the Score log to work properly

_____________________________

Michael

(in reply to Whicker)
Post #: 7
RE: SetScore question - 12/8/2019 2:38:53 AM   
michaelm75au


Posts: 13200
Joined: 5/5/2001
From: Melbourne, Australia
Status: online
There is code to handle the backward compatibility for no reason, but there is a bug in that.

_____________________________

Michael

(in reply to michaelm75au)
Post #: 8
RE: SetScore question - 12/8/2019 3:27:22 AM   
michaelm75au


Posts: 13200
Joined: 5/5/2001
From: Melbourne, Australia
Status: online

quote:

ORIGINAL: Whicker

hmm, seems like anything you do after the first SetScore results in an error. There is a 3rd argument that function accepts for the reason, I think it is optional but don't see anything expressly saying that. But it does the same thing with a reason.
It seems like it may work ok even with the error but I am not positive - I ran a quick test scen and it seemed to work, in the game.

Current code only works for SetScore() as the only command in the Lua script. Removing the backward comparability fixes it; it will still handle the case of 'no reason' given for the score change.

_____________________________

Michael

(in reply to Whicker)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> SetScore question Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.180