Any way to have 1000+ scripts?

Discuss all aspects related to modding Zandronum here.
Crimzon
 
Posts: 27
Joined: Sun Jun 15, 2014 6:01 am

Any way to have 1000+ scripts?

#1

Post by Crimzon » Wed Jul 09, 2014 6:21 am

I am scripting a lot for the wad I am working on and I heard that Zandronum does not support acs_namedexecute , so is there any way to have over 999 number of scripts?
Last edited by Crimzon on Wed Jul 09, 2014 6:53 am, edited 1 time in total.

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Any way to have 1000+ scripts?

#2

Post by Catastrophe » Wed Jul 09, 2014 7:47 am

No. But you can save space by turning some scripts into functions instead.

Also, the there is a maximum variable limit of 128. Remember this.

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Any way to have 1000+ scripts?

#3

Post by Konda » Wed Jul 09, 2014 8:40 am

Code: Select all

script 1 (int scriptnum)
{
  Switch(scriptnum)
  {
    case 1:
      //Script 1
      break;
    case 2:
      //Script 2
      break;
    [...]
    case 65536:
      //Script 65536
      break;
  }
}
Also I think there's a variable limit of 20 local variables per script. Not sure about the ones defined outside of a script.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: Any way to have 1000+ scripts?

#4

Post by ZzZombo » Wed Jul 09, 2014 1:34 pm

Special scripts (ENTER, OPEN, etc) can be declared as named, actually, even right now.

Code: Select all

script "MyMod_OPEN" OPEN
{
//stuff
}
so you can use their numbers for other scripts. You can only do that to special scripts, because otherwise you won't be able to call them.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Any way to have 1000+ scripts?

#5

Post by ibm5155 » Wed Jul 09, 2014 2:08 pm

Ehm
#define Blood_Script 1

script Blood_Script OPEN{
...
}
Now you have a named script that can be compiled on zandronum :lol:
Also I don't think there's a need for 1000 scripts, ofc you can reuse a lot of it, just use your brain a bit

Code: Select all

ex:
script 1 (void){ code(1); }
script 2 (void){ code(2); }
script 3 (void){ code(3); }
script 4 (void){ code(4); }

to

script 1 (int arg) { code(arg);}
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Crimzon
 
Posts: 27
Joined: Sun Jun 15, 2014 6:01 am

RE: Any way to have 1000+ scripts?

#6

Post by Crimzon » Wed Jul 09, 2014 5:55 pm

Wow every single one of you provided some nice information!

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Any way to have 1000+ scripts?

#7

Post by Catastrophe » Fri Jul 11, 2014 1:24 am

ibm5155 wrote: Also I don't think there's a need for 1000 scripts, ofc you can reuse a lot of it, just use your brain a bit
Yeah there is. Making multiple mods compatible with each other.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Any way to have 1000+ scripts?

#8

Post by Ijon Tichy » Fri Jul 11, 2014 1:45 am

Konda wrote:

Code: Select all

script 1 (int scriptnum)
{
  Switch(scriptnum)
  {
    case 1:
      //Script 1
      break;
    case 2:
      //Script 2
      break;
    [...]
    case 65536:
      //Script 65536
      break;
  }
}
You can only have 128 cases per switch block, by the way.

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Any way to have 1000+ scripts?

#9

Post by Catastrophe » Fri Jul 11, 2014 1:55 am

Ijon Tichy wrote:
Konda wrote:

Code: Select all

script 1 (int scriptnum)
{
  Switch(scriptnum)
  {
    case 1:
      //Script 1
      break;
    case 2:
      //Script 2
      break;
    [...]
    case 65536:
      //Script 65536
      break;
  }
}
You can only have 128 cases per switch block, by the way.
Interesting, I never knew about this one.

User avatar
TheMightyHeracross
Forum Regular
Posts: 176
Joined: Mon Aug 26, 2013 3:50 pm
Location: Philadelphia, PA

RE: Any way to have 1000+ scripts?

#10

Post by TheMightyHeracross » Fri Jul 11, 2014 3:29 am

Well 999 * 128 = 127,872. That should do! :smile:
Last edited by TheMightyHeracross on Fri Jul 11, 2014 3:29 am, edited 1 time in total.
THE MIGHTY HERACROSS

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Any way to have 1000+ scripts?

#11

Post by Torr Samaho » Fri Jul 11, 2014 5:10 pm

ZzZombo wrote: Special scripts (ENTER, OPEN, etc) can be declared as named, actually, even right now.

Code: Select all

script "MyMod_OPEN" OPEN
{
//stuff
}
so you can use their numbers for other scripts. You can only do that to special scripts, because otherwise you won't be able to call them.
Are you sure that this really works properly and that "MyMod_OPEN" is not just converted to its internal ACS string number?

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: Any way to have 1000+ scripts?

#12

Post by ZzZombo » Sat Jul 12, 2014 12:57 am

With bcc.exe, I'm not sure, but why would latest acc.exe do that? Both produced .WADs that worked correctly in the end.
Last edited by ZzZombo on Sat Jul 12, 2014 1:01 am, edited 1 time in total.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

User avatar
fr blood
Frequent Poster Miles card holder
Posts: 995
Joined: Wed Mar 06, 2013 4:04 pm
Location: France

RE: Any way to have 1000+ scripts?

#13

Post by fr blood » Tue Jul 29, 2014 4:16 am

Hi there, you can also use this:

Code: Select all

script 1 (int Typ)
{
If(Typ == 0)
{
}
If(Typ == 1)
{
}
If(Typ == 2)
{
}
[...]
If(Typ == 366)
{
}
}
I never tested it above 100, but it gives you a lot of choice for a single script.
Last edited by fr blood on Tue Jul 29, 2014 4:17 am, edited 1 time in total.

Konar6
Retired Staff / Community Team Member
Posts: 455
Joined: Sun May 27, 2012 9:38 am

RE: Any way to have 1000+ scripts?

#14

Post by Konar6 » Tue Jul 29, 2014 6:13 am

FYI you are the third one after ibm5155 and Konda to suggest this.
Ijon Tichy wrote:I like how your first responses to concerns being raised was to start insulting people, accusing random people on the Internet of being Shadowfox, and digging up irrelevant shit from the past. It really inspires confidence in me that you guys are level-headed and rational folks.


<BlueCool> you guys IQ is the same as my IP, Dynamic

User avatar
Dusk
Developer
Posts: 581
Joined: Thu May 24, 2012 9:59 pm
Location: Turku

RE: Any way to have 1000+ scripts?

#15

Post by Dusk » Tue Jul 29, 2014 10:31 am

fr blood wrote: Hi there, you can also use this:

Code: Select all

horrible code
I never tested it above 100, but it gives you a lot of choice for a single script.
That is not only ugly but also very inefficient because the ACS VM will wind up testing all those conditions separately with O(n) complexity.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: Any way to have 1000+ scripts?

#16

Post by ibm5155 » Tue Jul 29, 2014 1:07 pm

an else if would be welcome on blood code :lol:
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Any way to have 1000+ scripts?

#17

Post by Konda » Tue Jul 29, 2014 2:54 pm

You can also save script numbers by converting some scripts into functions. However you can't convert any script with delay() or tagwait() or anything that causes a delay, into a function. You also can't call functions from Decorate or via map specials. Only from an actual script you can call a function. But it's still an improvement.

I suppose you can also use switch blocks inside switch blocks to surpass the 128 cases limit, like this:

Code: Select all

Switch(script_number)
{
  case 0:
    [...]
    break;

  [...]

  case 126:
    [...]
    break;

  default:
    Switch(script_number)
    {
      case 127:
         [...]
         break;

      [...]

    }
    break;
}
Or if that's not going to work, then don't use Switchblockception:

Code: Select all

Switch(script_number)
{
  case 0:
    [...]
    break;
  
  [...]

  case 126:
    [...]
    break;

  default:
    break;
    //Not sure if this is actually necessary. If not, then replace this with case 127 and begin the next switch block with case 128
}

Switch(script_number)
{
  case 127:
    [...]
    break;

  [...]

  case 254:
    [...]
    break;

  default:
    break;
    //Same goes here
} 
:v

The complexity of that would be O(n/128) which is better than what ibm suggested (unless the switch statements operate exactly like the if/else statements). This is basically how to write horrible hacks 101.
Last edited by Konda on Tue Jul 29, 2014 3:12 pm, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Ivan
Addicted to Zandronum
Posts: 2229
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

RE: Any way to have 1000+ scripts?

#18

Post by Ivan » Tue Jul 29, 2014 3:02 pm

I always wondered, what is the reason for functions to not allow Delay in them? Does it break internally or what?
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: Any way to have 1000+ scripts?

#19

Post by Konda » Tue Jul 29, 2014 3:11 pm

Ivan wrote: I always wondered, what is the reason for functions to not allow Delay in them? Does it break internally or what?
From a logical standpoint, functions' purpose is calculation (for example, abs function). So it wouldn't make much sense if it had delays in it. However, the void functions don't return anything so they're pretty much the same as scripts, so I don't know why they're not allowed to have delays in them. I am not sure, but I think delays are not allowed in functions for technical reasons, not logical reasons.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

Catastrophe
Retired Staff / Community Team Member
Posts: 2571
Joined: Sat Jun 02, 2012 2:44 am

RE: Any way to have 1000+ scripts?

#20

Post by Catastrophe » Tue Jul 29, 2014 6:25 pm

Ivan wrote: I always wondered, what is the reason for functions to not allow Delay in them? Does it break internally or what?
Well you do have acs_executewait but it takes up a precious script slot.

Post Reply