Author Topic:  Strings and vars  (Read 293 times)

0 Members and 1 Guest are viewing this topic.

Hayden

  • Elite Member
  • *****
  • Posts: 516
  • Obey no one, Respect everyone.
  • Awards 1 year on site+100 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts
    • View Profile
    • Awards
  • Xbox: mister m0nk3y
  • Steam: Hayden
  • Other: 123456789
Strings and vars
« on: March 29, 2017, 05:23:04 PM »
Can a Variable equal a string?
Example


Var (killer) =((gamertag))
Context (target)
Notify [[killer] killed ((gamertag))


And it would possibly say something like
KillerDude6000 killed WaffleMaster26
Or would it be a failure...
Max characters: 300; characters remaining: 241

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4177
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Strings and vars
« Reply #1 on: March 29, 2017, 05:58:00 PM »
Nope. You can hash someone's gamertag and use that for internal comparison of someone's gamertag, But I think that would be useless for what you are trying to do.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

Hayden

  • Elite Member
  • *****
  • Posts: 516
  • Obey no one, Respect everyone.
  • Awards 1 year on site+100 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts
    • View Profile
    • Awards
  • Xbox: mister m0nk3y
  • Steam: Hayden
  • Other: 123456789
Re: Strings and vars
« Reply #2 on: March 30, 2017, 01:12:27 AM »
Nope. You can hash someone's gamertag and use that for internal comparison of someone's gamertag, But I think that would be useless for what you are trying to do.
how about something like this

var [gp] = [goldpieces]
inventory [player] [add] [gp] [200]

would this work fine?
Max characters: 300; characters remaining: 241

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4177
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Strings and vars
« Reply #3 on: March 30, 2017, 08:20:11 AM »
Nope. You can hash someone's gamertag and use that for internal comparison of someone's gamertag, But I think that would be useless for what you are trying to do.
how about something like this

var [gp] = [goldpieces]
inventory [player] [add] [gp] [200]

would this work fine?

Nope. There are no strings in variables.

I forget the exact problem with them, But I think Craig said strings are immutable, And create a lot of garbage.


1. Strings [text] in C# are immutable and always allocated on the heap. So all string replacement/substitution must allocate a new string, on the heap, which creates garbage. A lot of garbage when it's done frequently. Too much garbage generation causes garbage collections, which cause CPU stalls for up to 500 ms. This is the main reason I changed scripts from interpreted to bytecode.

I do remember now that Craig said he could possibly create his own string type for scripts. But that isn't in the game.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

Hayden

  • Elite Member
  • *****
  • Posts: 516
  • Obey no one, Respect everyone.
  • Awards 1 year on site+100 posts Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site+300 posts
    • View Profile
    • Awards
  • Xbox: mister m0nk3y
  • Steam: Hayden
  • Other: 123456789
Re: Strings and vars
« Reply #4 on: March 30, 2017, 01:00:04 PM »
Nope. You can hash someone's gamertag and use that for internal comparison of someone's gamertag, But I think that would be useless for what you are trying to do.
how about something like this

var [gp] = [goldpieces]
inventory [player] [add] [gp] [200]

would this work fine?

Nope. There are no strings in variables.

I forget the exact problem with them, But I think Craig said strings are immutable, And create a lot of garbage.


1. Strings [text] in C# are immutable and always allocated on the heap. So all string replacement/substitution must allocate a new string, on the heap, which creates garbage. A lot of garbage when it's done frequently. Too much garbage generation causes garbage collections, which cause CPU stalls for up to 500 ms. This is the main reason I changed scripts from interpreted to bytecode.

I do remember now that Craig said he could possibly create his own string type for scripts. But that isn't in the game.
Okay, thank you very much! I guess all we do now is wait...
Max characters: 300; characters remaining: 241