Any way to have 1000+ scripts?
Any way to have 1000+ scripts?
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?
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.
Also, the there is a maximum variable limit of 128. Remember this.
RE: Any way to have 1000+ scripts?
Code: Select all
script 1 (int scriptnum)
{
Switch(scriptnum)
{
case 1:
//Script 1
break;
case 2:
//Script 2
break;
[...]
case 65536:
//Script 65536
break;
}
}Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsodRE: Any way to have 1000+ scripts?
Special scripts (ENTER, OPEN, etc) can be declared as named, actually, even right now.
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.
Code: Select all
script "MyMod_OPEN" OPEN
{
//stuff
}- 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?
Ehm
#define Blood_Script 1
script Blood_Script OPEN{
...
}
Now you have a named script that can be compiled on zandronum
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
#define Blood_Script 1
script Blood_Script OPEN{
...
}
Now you have a named script that can be compiled on zandronum
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">
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">
RE: Any way to have 1000+ scripts?
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?
Yeah there is. Making multiple mods compatible with each other.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
-
Ijon Tichy
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
RE: Any way to have 1000+ scripts?
You can only have 128 cases per switch block, by the way.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; } }
-
Catastrophe
- Retired Staff / Community Team Member
- Posts: 2571
- Joined: Sat Jun 02, 2012 2:44 am
RE: Any way to have 1000+ scripts?
Interesting, I never knew about this one.Ijon Tichy wrote:You can only have 128 cases per switch block, by the way.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; } }
- TheMightyHeracross
- Forum Regular
- Posts: 176
- Joined: Mon Aug 26, 2013 3:50 pm
- Location: Philadelphia, PA
RE: Any way to have 1000+ scripts?
Well 999 * 128 = 127,872. That should do! 
Last edited by TheMightyHeracross on Fri Jul 11, 2014 3:29 am, edited 1 time in total.
THE MIGHTY HERACROSS
- Torr Samaho
- Lead Developer
- Posts: 1543
- Joined: Fri May 25, 2012 6:03 pm
- Location: Germany
RE: Any way to have 1000+ scripts?
Are you sure that this really works properly and that "MyMod_OPEN" is not just converted to its internal ACS string number?ZzZombo wrote: Special scripts (ENTER, OPEN, etc) can be declared as named, actually, even right now.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.Code: Select all
script "MyMod_OPEN" OPEN { //stuff }
RE: Any way to have 1000+ scripts?
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.
- 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?
Hi there, you can also use this:
I never tested it above 100, but it gives you a lot of choice for a single script.
Code: Select all
script 1 (int Typ)
{
If(Typ == 0)
{
}
If(Typ == 1)
{
}
If(Typ == 2)
{
}
[...]
If(Typ == 366)
{
}
}
Last edited by fr blood on Tue Jul 29, 2014 4:17 am, edited 1 time in total.
RE: Any way to have 1000+ scripts?
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
RE: Any way to have 1000+ scripts?
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.fr blood wrote: Hi there, you can also use this:I never tested it above 100, but it gives you a lot of choice for a single script.Code: Select all
horrible code
- 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?
an else if would be welcome on blood code 
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">
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">
RE: Any way to have 1000+ scripts?
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:
Or if that's not going to work, then don't use Switchblockception:
: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.
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;
}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
} 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 bsodRE: Any way to have 1000+ scripts?
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 ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
RE: Any way to have 1000+ scripts?
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.Ivan wrote: I always wondered, what is the reason for functions to not allow Delay in them? Does it break internally or what?
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?
Well you do have acs_executewait but it takes up a precious script slot.Ivan wrote: I always wondered, what is the reason for functions to not allow Delay in them? Does it break internally or what?